4 Replies Latest reply on Nov 10, 2006 6:04 AM by thejokerman05


    thejokerman05 Level 1
      Please have a look at my xml code below. I've managed to get all the "mainTitles" into an array called mm_array. Now I need to get all the "subTitles" under "main 1" into an array called "sm1_array", "subTitles" under "main 2" into an array called "sm2_array" and so on. I twist my brain on this, some help anyone?

        • 1. Re: XML...???
          arunbe Level 1
          i think,

          The xml structure u are using is bit sketchy to parse our easily.
          we can parse out this xml in the same format what u are expected.
          but, if you add more , it will be more sketchy.
          So, try to change the xml structure like the following...

          cool :)
          • 2. Re: XML...???
            thejokerman05 Level 1
            Ok, thanks. I've changed the structure of my xml file like you proposed. My question is now if I need to have a for loop for every array I want to create?

            • 3. Re: XML...???
              Hi jokerman,
              this works, but it's not the best way to parse xml files. It depends on what you want to do with the arrays once they're created.
              with the attached code, the "sm0_array", "sm1_array", etc are created within the scope of the "loadXML" object, which isn't a good idea, generally speaking.
              • 4. Re: XML...???
                thejokerman05 Level 1
                Thanks, I will try this. And also put the creation of the arrays in an outside function, maybe thats a better idea? Why shouldn't it be inside the loadXML object?