PXP2
Polygeek Xml Parsing Project (PXP2)
If you’re building a RIA (Rich Internet Application) you’ll probably be dealing with XML by either loading an XML file from the server or using a web service. Externalizing your data is the only way to fly. The downside is dealing with the XML data inside of Flash. There’s all that childNode, nextSibling, parentNode crap to deal with to get at your data.
Download PXP2 class and examples zip file. (2007.03.09 Note: I have changed my namespace from “polyGeekcom” to “com.polygeek” - yes, I know I should have done that in the first place.)
What would be nice is to parse your XML data into an Object. Suppose you have the following XML:
<blogroll>
<blog>polyGeek.com</blog>
</blogroll>Wouldn’t it be nice to get to that string of data with this sort of code:
trace(blogRoll.blog) // ouptut: polyGeek.com
Or if we have this XML:
<blogroll>
<blog>polyGeek.com</blog>
<blog>flashden.net/article</blog>
<blog>weblogs.macromedia.com/jd</blog>
<blog>blog.digitalbackcountry.com</blog>
<blog>blogs.zdnet.com/Stewart</blog>
<blog>richardleggett.co.uk/blog</blog>
<blog>www.gskinner.com/blog</blog>
</blogroll>We would like to be able to do this:
var len:Number = blogRoll.blog.length; for(var i:Number = 0; i < len; ++i) { trace(blogRoll.blog[i]); }
And get the following output:
polyGeek.com flashden.net/article weblogs.macromedia.com/jd blog.digitalbackcountry.com blogs.zdnet.com/Stewart richardleggett.co.uk/blog www.gskinner.com/blog
Next: Make it so











