1 Reply Latest reply on Feb 23, 2011 11:45 AM by hughqelliott

    formatting XML createElement createTextNode not recognized

    Chris McLaughlin Level 1

      Hi,

       

      I'm new to Air.  Working in AS3, I am trying to write data to an xml file.  Using createElement and createTextNode to format the data produces a warnign that they are not a "recognized method of the dynamic class XML"  So I guess the first question is whether these methods are not supported when using air?  Second, how would I format XML data in air otherwise?  I'd appreciate any help you can offer.

       

      Best regards,

       

       

       

      Chris McLaughlin

        • 1. Re: formatting XML createElement createTextNode not recognized
          hughqelliott

          This is a pretty old question, I realize, but since I was just monkeying with this today, I figured I'd go ahead and post my result.

           

          createElement and createTextNode is gone.

           

          instead use:

           

          var xmlNode:XMLNode = new XMLNode(XMLNodeType.ELEMENT_NODE,"NODE_NAME");

           

          NODE_NAME being whatever you intended to name that node.  that creates <NODE_NAME/>

           

          then you can do all the normal stuff like

           

          xmlNode.attributes.VALUE = "75";

          to make the node

          <NODE_NAME VALUE="75"/>

           

          var secondNode:XMLNode = new XMLNode(XMLNodeType.ELEMENT_NODE,"CHILD_NODE");

           

          xmlNode.appendChild(secondNode);

          looks like:

          <NODE_NAME VALUE="75"><CHILD_NODE/></NODE_NAME>

           

          hope this helps someone in the same pickle.