5 Replies Latest reply on Apr 1, 2007 6:04 AM by abeall

    Accessing XML Tree in flash

    Non-nelson
      Hi all,

      I am in the process of learning about XML & I like to find out how can i access the XML Tree as shown here

      Appreciate any help rendered that will help aid my learning process,thanks...
        • 1. Re: Accessing XML Tree in flash
          abeall Level 3
          "You can get this kind of output by running the debugger and putting a breakpoint in processXMLData."
          • 2. Re: Accessing XML Tree in flash
            Non-nelson Level 1
            Yeah, i did read that and I did set up a breakpoint at the line but to no avail,nothing comes up on the debugger...
            Is it inserted it at the wrong line?

            function processXMLData(success) <------- BREAKPOINT HERE
            {
            if (success)
            {
            var rootNode=this.firstChild;

            var headerNode=findNode(rootNode, "header");
            header=getValue(headerNode);

            var contentNode=findNode(rootNode, "content");
            content=getValue(contentNode);

            var authorNode=findNode(rootNode, "author");
            author=getValue(authorNode);


            /*
            var newsNode=this.firstChild;
            var headerNode=newsNode.childNodes[0];
            var contentNode=newsNode.childNodes[1];
            var infoNode=newsNode.childNodes[2];
            var authorNode=infoNode.childNodes[1];

            header=headerNode.firstChild.nodeValue;
            content=contentNode.firstChild.nodeValue;
            author=authorNode.firstChild.nodeValue;
            */
            }
            else
            {
            content="Today's news is not found";
            }
            }

            function getValue(node)
            {
            if (node && node.firstChild)
            return node.firstChild.nodeValue;
            return "";
            }

            Much Thanks...
            • 3. Re: Accessing XML Tree in flash
              kwyjibo12ret
              hello non-nelson, do you know what this long piece of code above does?
              i will be grateful 4 a small explanation as i am eager 2 learn. thanks.
              • 4. Re: Accessing XML Tree in flash
                Non-nelson Level 1
                Hi,
                very briefly, this piece of code is only a segment of what needs to be done in the case client "mess" up the node in the .xml files and is a function performed after .xml is loaded. Me too am in the process of learning about xml, look Here for more!

                x Still trying to find out how to use breakpoint to view XML TREE x
                • 5. Re: Accessing XML Tree in flash
                  abeall Level 3
                  Breakpoint looks like it's in the right place, just do Control > Debug Movie, hit play, then it will break on that code and you can click the Variables tab, and it should show you the XML tree in there somewhere.