Skip to main content
Inspiring
January 22, 2013
Answered

Getting all the text values in an XML node

  • January 22, 2013
  • 1 reply
  • 957 views

Suppose I've got an XMLList that I'm working my way through and I want to quickly and easily get all the "text" from the node. In other works strip out all the <xmtag> mark up and possible attributes and just leave the content.

Is there an easy/fast way to do that?

<myNode>

     <title>The title of an event here</title>

     <presenter>Name and title of presenter here</presenter>

     <date startTime="Somedate" />

      <desc><![CDATA[Some text in here. It <b>might</b> have html or links or some such.]]></desc>

     <resources>

          <res>A list of some resources, downloads, etc.</res>

           <res>Some other site or some such</res>

     </resources>

</myNode>

This topic has been closed for replies.
Correct answer kglad

if xml is your XML instance, after loading is complete:

trace(xml.descedants("*").text());

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 23, 2013

if xml is your XML instance, after loading is complete:

trace(xml.descedants("*").text());

RothrockAuthor
Inspiring
January 23, 2013

Awesome. I'm going to give that at try and see if I can speed up my indexing code. A big chunk of it has been removing all the "junk" before stemming the words.

kglad
Community Expert
Community Expert
January 23, 2013

i'm not sure how fast that is but it's sure easy to code.