When you’re working with Flash and dynamic content your no stranger to XML.
And how to access the data in the XML.
There are a couple of ways you can access and manipulating XML documents in Flash:
- the nerdy way (XML DOM):
my_xml.firstChild.childNodes[2].childNodes[1].attributes.x
- the xPath way using xfactorstudio XPath classes:
xmlDoc.selectNodes("/bookstore/book[price>35]/title")
- the Flash XPathAPI class:
XPathAPI.selectNodeList(xml.firstChild, "/rdf:RDF/item/title")
- the XML2Array methode:
Novel[0].Description[0].value
Before I discovered option 2 /3 /4, I had to work with XML DOM. This was also in the periode I was still programming in the Flash IDE and the XML DOM methode cost me a lot of time: I couldn’t find the correct node, or attribute, etc.
Until I started programming in SE|PY, because it has a XML Reader. The XML Reader could check if my XML was correctly formatted, and I could just point to the node I wanted to use and it gave me the correct node path.
I don’t know when it started (probably for a while, because I started to use different methodes to access XML) but sadly this reader has some errors, which makes it difficult to use.
But why do I care? I needed to use the XML DOM because I didn’t want to add to the kb of a dynamic banner I was building. It was programmed it in Flash IDE and the SE|PY XML Reader didn’t work….
Download:
Without more blabla: here is the first version of XML Reader.
XML Reader Flash panel XML_Reader_v0.1.zip (52kB)
In the zip is also a readme.txt with more info about XML Reader.
Doubts? Test drive it here!
Let me know what you think of it, what’s wrong with it, what could improve, bugs, etc
Description XML Reader
XML Reader is a Flash window panel where you can load XML files into.
This is useful in situations when you are writing an XML parser, and need to view the XML your parsing, but don’t feel like toggling back and forth between Flash and another program.
As a Flash panel, you can simply dock it inside of Flash with your other panels, and have it always available while you code in the Flash IDE.
This XML Reader does more: it has color syntax highlighting, indentation and XML DOM(*) to access and manipulate XML Documents WYSIWYG style.
I hope this will help to increase my productivity, and perhaps yours?
(*) The XML Document Object Model (XML DOM) defines a standard way for accessing and manipulating XML documents.
View XML Reader
So I created XML Reader, based upon the one in SE|PY
Because the open XML button only works in Flash a example XML is loaded.
Thanx to:
This project is based upon some work of other developers:
- The XMLHighlighter class developed by R.Arul Kumaran (at the moment of writing this post I couldn’t visit his site).
This class is used for highlighting the XML file and my modification makes it possible to ‘trace’ the XML-nodes. - The XML and Text Viewer Panel developed by Jesse Randall Warden. This example showed me how to build a panel.
- The MXI File Creator by Muzakdeezign. This free program is used to create and edit the Macromedia Extension (.mxi file).
- The XML reader from SE|PY by Alessandro Crugnola.
This is my free code editor when I’m not using the Flash IDE editor. And the only (as far as I know) wysiwyg XML Reader. Sadly this reader has some errors, which makes it difficult to use. So to fix this, I wrote this panel.