p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XML (http://p2p.wrox.com/forumdisplay.php?f=91)
-   -   xml and flash (http://p2p.wrox.com/showthread.php?t=58897)

ekosoft June 9th, 2007 10:06 AM

xml and flash
 
ok, i have this part of a code, its pulling the xml and putting it into text boxes.

Code:

      var minorsnodes:Array = newxml.firstChild.firstChild.nextSibling.childNodes;
      for (var i:Number = 0; i < minorsnodes.length; i++) {
         // for each mode node:
         var minornode:XMLNode = minorsnodes[i];
         modes.push(
            {i:i+1,
             pname:minornode.attributes.name,
             desc:minornode.childNodes[0].attributes.name,
             desc1:minornode.childNodes[1].attributes.name,
             desc2:minornode.childNodes[2].attributes.name,
             desc3:minornode.childNodes[3].attributes.name,
             score:minornode.childNodes.childNodes[1].attributes.value
         });
         //2d array
         //xslt html
      }



this is the xml being used

Code:

<?xml version="1.0" encoding="UTF-8"?>
<scorelist version="0">
   <user>Sciandu</user>
   <game name="Harmonic Convergence Deluxe">
     <major_mode name="Race">
       <minor_mode display_mode="time" name="Asteroid">
         <score value="35" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Breach">
         <score value="65" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Radioactive Rose">
         <score value="24" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Art">
         <score value="42" login="Sciandu"/>
         <score value="54" login="Mehh"/>
         <score value="54" login="tmp1"/>
         <score value="91" login="User1"/>
         <score value="99" login="Sciandu"/>
       </minor_mode>
     </major_mode>
     <major_mode name="Challenge">
       <minor_mode display_mode="number" name="-">
         <score value="14" login="Sciandu"/>
       </minor_mode>
     </major_mode>
     <major_mode name="Frenzy">
       <minor_mode display_mode="number" name="Camp Fire">
         <score value="79" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="number" name="Art">
         <score value="54" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="number" name="Ritual">
         <score value="59" login="tmp1"/>
         <score value="53" login="Sciandu"/>
         <score value="2" login="Mehh"/>
       </minor_mode>
     </major_mode>
   </game>
</scorelist>

what i need to do is be able to index the minor modes into one text box instead of each one having their own and index them into one, and i need to be able to index each score for each minor mode accordingly. The problem is it wont let me index if i use childNodes[i] here
Code:

desc1:minornode.childNodes[1].attributes.name,
im guessing its because its already in an index, but i dont know, can anyone help me?


joefawcett June 10th, 2007 03:20 AM

Sorry I can't follow your terminology, not sure what index means and there are no textboxes. Can you show an example of what output you want? At the moment your expression newxml.firstChild.firstChild.nextSibling.childNode s seems to refer to the major_mode elements.

--

Joe (Microsoft MVP - XML)


All times are GMT -4. The time now is 01:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.