1 Reply Latest reply on Jun 20, 2010 8:49 PM by PeakDigital

    appendChild converts XML tags to HTML entities?!

    PeakDigital Level 1

      I am working on an e4x statement. It is supposed to convert an XMLListCollection to a plain XML object. It ran without errors, but the destination object stayed blank. During debug I watched the variable value and found that as soon as the XML object ran the .appendChild command, all the appended XML content had its < and > characters replaced by &lt; and &gt;  which I can only assume killed the XML and caused my new object to remain empty.

       

      xmlTreeContents.appendChild(_modelListManagerTreeData.xmlTreeData);

       

      xmlTreeContents is the XML object, _modelListManagerTreeData.xmlTreeData is an XMLListCollection.

       

      A quick search turned up someone else with the same problem: http://stackoverflow.com/questions/2540414/flex-3-xml-remplacing-by-lt Unfortunately  no one answered him, and I can't find another reference to this issue.

       

      Has anyone here seen this problem, and can give me direction on what to do to solve it?

       

      Thanks.

      Paul

        • 1. Re: appendChild converts XML tags to HTML entities?!
          PeakDigital Level 1

          I don't have a clue what is going on, but I found a way around it:

           

          I was initially using

           

          xmlTreeContents=<treeContents></treeContents>;
          xmlTreeContents.appendChild(_modelListManagerTreeData.xmlTreeData);
          
          

          and that caused the &lt; &gt replacements.

           

          Then I tried this and it works perfectly

           

          var f:String="<treeContents>" + _modelListManagerTreeData.xmlTreeData.toXMLString() + "</treeContents>";
          xmlTreeContents=XML(f);

           

          Still confused, but hopefully this workaround can help someone else.