“Be inspired, enjoy your work, keep learning and never forget to play.” — gskinner

Get the name of all Xml nodes and Attributes

Posted: March 13th, 2008 | Author: Ivan Valadares | Filed under: Actionscript3, Code | 13 Comments »

How many times do we have an XML that comes from a webservice or from a source 
that we don't know. In these times getting that xml to a file can be cumbersome (imagine that you have authentication). So how about a nice little way to see all the node and attribute names in that xml, here's how:

Take this xml as an example:
file

For this file we'd get something like:
NODE NAME: Mouse
NODE NAME: ScreenSaver
ATTRIBUTE OF ScreenSaver NAME: desc
NODE CHILD OF ScreenSaver NAME: Active
ATTRIBUTE OF Active NAME: desc
NODE CHILD OF ScreenSaver NAME: File
ATTRIBUTE OF File NAME: desc
NODE CHILD OF ScreenSaver NAME: Time
ATTRIBUTE OF Time NAME: desc
ATTRIBUTE OF Time NAME: min
ATTRIBUTE OF Time NAME: max
ATTRIBUTE OF Time NAME: unit

Hope this helps you out.