4 Replies Latest reply on Sep 16, 2007 12:31 PM by typeguydesign

    XMLparsing

    Level 7
      Help plz

      I need to make an XML parser .This should pars the xml to any (n) level of
      depth with any (m) number of childs within root node.
      I then need to use the xml data in flash.
      Have already done for 3 levels depth .Confused how ro make for n levels.

      Please give me source.
      thanks in Advance.


        • 1. Re: XMLparsing
          Level 7
          Is there a reason you can't use Flash's own XML parser?

          --
          Dave -
          Head Developer
          http://www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. Re: XMLparsing
            Level 7
            That helps to parse the xml with any number of childs and depth level to an
            array ?
            I have done parsing using nextSibling , childNodes etc of XML() object.but
            that requires putting own logic to actually parse the XML file.
            Please guide me furthur.
            Thanks


            "DMennenoh **AdobeCommunityExpert**" <dave@blurredistinction.com> wrote in
            message news:fc8oub$hiq$1@forums.macromedia.com...
            > Is there a reason you can't use Flash's own XML parser?
            >
            > --
            > Dave -
            > Head Developer
            > http://www.blurredistinction.com
            > Adobe Community Expert
            > http://www.adobe.com/communities/experts/
            >


            • 3. Re: XMLparsing
              Some1Won
              Hm, well you could just grab all the child nodes of a node and loop through them, and then recursively go and add them to an array. Then it wouldn’t matter how deep or how long the xml file is. More or less the same way you’d go through an entire tree.
              • 4. Re: XMLparsing
                typeguydesign Level 1
                Quick question regarding this.
                I get the parsing bit myself and can grab the info. I'm not sure what's next.
                My XML File sample:
                -----------------------------------------
                <?xml version="1.0" encoding="UTF-8"?>
                <portfolio>

                <category name="Some Title Here">

                <client name="Company 1" project="Name of Project" description="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In pulvinar, magna eget viverra suscipit, libero elit imperdiet justo, vel pretium quam ipsum ac odio. Morbi non neque sit amet sapien mollis adipiscing. Morbi non eros. Quisque quis nisi. Aenean id magna. Etiam id nulla vitae nisi feugiat ultrices.">

                <image imgName="Bugs" thumb="images/image_1.jpg" large="images/image_1_large.jpg" />
                <image imgName="Cats" thumb="images/image_2.jpg" large="images/image_2_large.jpg" />
                <image imgName="Toys" thumb="images/image_3.jpg" large="images/image_3_large.jpg" />
                </client>

                </category>

                <category name="Another Category">

                <client name="Company 2" project="More Work for Someone" description="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In pulvinar, magna eget viverra suscipit, libero elit imperdiet justo, vel pretium quam ipsum ac odio. Morbi non neque sit amet sapien mollis adipiscing. Morbi non eros. Quisque quis nisi. Aenean id magna. Etiam id nulla vitae nisi feugiat ultrices.">

                <image imgName="Bugs" thumb="images/image_1.jpg" large="images/image_1_large.jpg" />
                <image imgName="Cats" thumb="images/image_2.jpg" large="images/image_2_large.jpg" />
                <image imgName="Toys" thumb="images/image_3.jpg" large="images/image_3_large.jpg" />

                </client>

                </category>

                </portfolio>

                </xml>
                -----------------------------------------
                I added space to see it better.
                Would this be better as an Object instead with parameters for each bit of info?
                I have arrays and can gather info but seems better to be an object with all contained inside.

                Opinions appreciated.

                Thanks