Re: [Gambas-user] Getting the un-specialed XMLElement.TextContent string

2014-06-25 Thread Fabien Bodard
Le 25 juin 2014 01:04, B Bruen bbr...@paddys-hill.net a écrit :

 On Tue, 24 Jun 2014 16:36:11 +0200
 Adrien Prokopowicz adrien.prokopow...@gmail.com wrote:

  Le Tue, 17 Jun 2014 01:37:49 +0200, B Bruen bbr...@paddys-hill.net a
  écrit:
 
   (I'm sure I've done this before, but I can't find my prior code nor
can
   I find it in either of the help sites.)
  
   I just want to set a string variable to the text content of an
element.
   I am almost certain there was a way to have it automatically convert
all
   the special characters, like nbsp, lt, etc etc to their normal
   representation.  Is there such a function, or was I just dreaming?
  
   tia
   Bruce
  
 
  (Sorry about the late answer, I was quite busy these last few months
...)
 
  The XmlNode.TextContent property is actually what you're looking for :
it
  defines the node's text content without these entities. For example,
this
  little code :
 
 Dim doc As New XmlDocument
 
 doc.FromString(xmlFish amp; chips/xml) 'This can be
doc.Open(),
  doc.Content = ... or whatever
 
 Print doc.ToString()
 
 Print doc.Root.TextContent
 
  ... will output this :
 
 ?xml version=1.0 encoding=UTF-8?xmlFish amp; chips/xml
 Fish  chips
 
  Moreover, you have the static couple of methods XmlNode.Serialize() and
  XmlNode.Deserialize() that allow you to convert strings back and forth
  between the with entities and without entities representations.
 
  Regards,
  --
  Adrien Prokopowicz
 
 Adrien,

 That's what I thought. But now I found my problem.

 The special characters are in the attributes of the element, not in the
text content.  Here's an example:

 (racenode is an XMLElement)

 ? racenode.Tostring(true)
 Race RaceNo=8 RaceTime=2014-06-25T15:55:00 RaceName=C,Gamp;E 0 -
68 HANDICAP Distance=1211 WeatherChanged=N WeatherCond=3
WeatherDesc=Showery TrackChanged=N TrackCond=5 TrackDesc=Heavy
 ( inner content excised )
 /Race

 I'm looking at a bit of code that is:
 $title = raceNode.Attributes[RaceName]
 which ends up with the raw value, viz
 C,Gamp;E 0 - 68 HANDICAP

 Is there a way to get an attribute value de-specialed?
$title = xmlnode.deserialize(raceNode.Attributes[RaceName])

No? B-)


 tia
 Bruce
 --
 B Bruen bbr...@paddys-hill.net


--
 Open source business process management suite built on Java and Eclipse
 Turn processes into business applications with Bonita BPM Community
Edition
 Quickly connect people, data, and systems into organized workflows
 Winner of BOSSIE, CODIE, OW2 and Gartner awards
 http://p.sf.net/sfu/Bonitasoft
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Getting the un-specialed XMLElement.TextContent string

2014-06-25 Thread B Bruen
On Wed, 25 Jun 2014 09:21:30 +0200
Fabien Bodard gambas...@gmail.com wrote:

 $title = xmlnode.deserialize(raceNode.Attributes[RaceName])
 
 No? B-)

Ah, OK. Thanks, the fact that it was a static function hadn't sunk in.

regards
Bruce

-- 
B Bruen bbr...@paddys-hill.net

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Getting the un-specialed XMLElement.TextContent string

2014-06-24 Thread Adrien Prokopowicz
Le Tue, 17 Jun 2014 01:37:49 +0200, B Bruen bbr...@paddys-hill.net a  
écrit:

 (I'm sure I've done this before, but I can't find my prior code nor can  
 I find it in either of the help sites.)

 I just want to set a string variable to the text content of an element.   
 I am almost certain there was a way to have it automatically convert all  
 the special characters, like nbsp, lt, etc etc to their normal  
 representation.  Is there such a function, or was I just dreaming?

 tia
 Bruce


(Sorry about the late answer, I was quite busy these last few months ...)

The XmlNode.TextContent property is actually what you're looking for : it  
defines the node's text content without these entities. For example, this  
little code :

   Dim doc As New XmlDocument

   doc.FromString(xmlFish amp; chips/xml) 'This can be doc.Open(),  
doc.Content = ... or whatever

   Print doc.ToString()

   Print doc.Root.TextContent

... will output this :

   ?xml version=1.0 encoding=UTF-8?xmlFish amp; chips/xml
   Fish  chips

Moreover, you have the static couple of methods XmlNode.Serialize() and  
XmlNode.Deserialize() that allow you to convert strings back and forth  
between the with entities and without entities representations.

Regards,
-- 
Adrien Prokopowicz

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Getting the un-specialed XMLElement.TextContent string

2014-06-24 Thread B Bruen
On Tue, 24 Jun 2014 16:36:11 +0200
Adrien Prokopowicz adrien.prokopow...@gmail.com wrote:

 Le Tue, 17 Jun 2014 01:37:49 +0200, B Bruen bbr...@paddys-hill.net a  
 écrit:
 
  (I'm sure I've done this before, but I can't find my prior code nor can  
  I find it in either of the help sites.)
 
  I just want to set a string variable to the text content of an element.   
  I am almost certain there was a way to have it automatically convert all  
  the special characters, like nbsp, lt, etc etc to their normal  
  representation.  Is there such a function, or was I just dreaming?
 
  tia
  Bruce
 
 
 (Sorry about the late answer, I was quite busy these last few months ...)
 
 The XmlNode.TextContent property is actually what you're looking for : it  
 defines the node's text content without these entities. For example, this  
 little code :
 
Dim doc As New XmlDocument
 
doc.FromString(xmlFish amp; chips/xml) 'This can be doc.Open(),  
 doc.Content = ... or whatever
 
Print doc.ToString()
 
Print doc.Root.TextContent
 
 ... will output this :
 
?xml version=1.0 encoding=UTF-8?xmlFish amp; chips/xml
Fish  chips
 
 Moreover, you have the static couple of methods XmlNode.Serialize() and  
 XmlNode.Deserialize() that allow you to convert strings back and forth  
 between the with entities and without entities representations.
 
 Regards,
 -- 
 Adrien Prokopowicz
 
Adrien,

That's what I thought. But now I found my problem.

The special characters are in the attributes of the element, not in the text 
content.  Here's an example:

(racenode is an XMLElement)

? racenode.Tostring(true)
Race RaceNo=8 RaceTime=2014-06-25T15:55:00 RaceName=C,Gamp;E 0 - 68 
HANDICAP Distance=1211 WeatherChanged=N WeatherCond=3 
WeatherDesc=Showery TrackChanged=N TrackCond=5 TrackDesc=Heavy
( inner content excised )
/Race

I'm looking at a bit of code that is:
$title = raceNode.Attributes[RaceName]
which ends up with the raw value, viz
C,Gamp;E 0 - 68 HANDICAP

Is there a way to get an attribute value de-specialed?

tia
Bruce
-- 
B Bruen bbr...@paddys-hill.net

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Getting the un-specialed XMLElement.TextContent string

2014-06-16 Thread B Bruen
(I'm sure I've done this before, but I can't find my prior code nor can I find 
it in either of the help sites.)

I just want to set a string variable to the text content of an element.  I am 
almost certain there was a way to have it automatically convert all the 
special characters, like nbsp, lt, etc etc to their normal 
representation.  Is there such a function, or was I just dreaming?

tia
Bruce

-- 
B Bruen bbr...@paddys-hill.net

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing  Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user