3 Replies Latest reply on May 8, 2006 2:08 PM by babo_ya

    Load data from xml problem

    mgum
      I need to load data from an xml file. I have two variables
      inwhat= and name=
      when it populates the textfields in flash it just says undefined.

      Any ideas what is wrong?
        • 1. Re: Load data from xml problem
          babo_ya Level 3
          Because you are not loading your XML correctly.
          Show me the XML file.
          • 2. Re: Load data from xml problem
            mgum Level 1
            this is what is on my xml file

            <?xml version='1.0' encoding='utf-8'?>
            <names>
            <name="Joe Smith" inwhat="honor"/>
            <name="Jane Smith" inwhat="memory"/>
            </names>

            what should my code look like in actionscript?

            Thanks for the help.
            • 3. Re: Load data from xml problem
              babo_ya Level 3

              var rootNode, i;
              rootNode = XML_Object.firstChild;

              rootNode = rootNode.firstChild;

              for(i = 0; i < rootNode.childNodes.length; i ++)
              {
              var personObj bject = new Object();
              personObj.name = rootNode.childNodes .attributes.name;
              personObj.inwhat = rootNode.childNodes
              .attributes.inwhat;
              personAry.push(personObj);
              }


              But, I think your XML file is incorrect.
              <name="joe smith" inwhat="honor" />
              should be... something like..
              <person name="joe smith" inwhat='honor" />