Hi there,
I'm programming in AS3 with Flex Builder 3 and have a question. I'm parsing XML that has many different node names. To make my life easier I have these node names in an array. I want to parse the array, grab blocks of XML that coorespond to the sections as stored in the array. This bombs out however and doesn't seem to be possible. Here's an example:
Demo XML:
As shown above I want to access the sections health and safety where each are their own indicy in the array. Here's my AS3 code and flex.Code:<website> <health> <page num="1" type="link" /> <page num="2" type="url" /> </health> <safety> <page num="1" type="link" /> <page num="2" type="url" /> </safety> </website>
If you see above the values stored in siteSections are going to be dynamically listed to pull in the right section from the approp. index in the array. I get no results back. I even tried converting the value in siteSections to an XMLNode but that didn't work either. Any help would be greatly appreciated.Code:private var siteSections:Array = new Array("health","safety"); for (var i:Number = 0; i < this.siteSections.length; i++) { // we want to iterate over all the sections // this.currXML contains the block of website XML for each (var currentPage:XML in this.currXML.siteSections[i].page) { if (currentPage.@id == 0) { this.siteTree += "<folder label=\""+currentPage.@id+"\" section=\""+siteSections[i]+"\" isleftnav=\"\"></folder>"; } } }






Bookmarks