1 Reply Latest reply on Oct 29, 2010 5:46 AM by Alex Luthor

    How to get all xml text nodes ?

    Alex Luthor

      I want to assign to a string variable

      the text of all text nodes in a xml


      for example


      i have this xml:



      <book category="cooking">

      <title lang="en">Everyday Italian</title>

      <author>Giada De Laurentiis</author>




      <book category="children">

      <title lang="en">Harry Potter</title>

      <author>J K. Rowling</author>






      and i want this result


      var s:String = "Everyday ItalianGiada De Laurentiis200530.00Harry PotterJ K. Rowling200529.99";


        • 1. Re: How to get all xml text nodes ?
          Alex Luthor Level 1

          public function getAllXMLTextNodes( xml:XML ):String {

          var s:String = xml.toString();

          var regX:RegExp = /,/gi;

          s = s.replace( regX, "&#44;");

          var a:Array = [];

          a = s.split(/<.*?>/g);

          s = StringUtil.trimArrayElements( a.toString(), "" );

          s = s.replace( regX, "");

          s = s.replace( /&#44;/gi , ",");

          return s;



          this working