Converting the xml dom to a javascript object (JXML)...
NODES (compare to xml document):
EXAMPLES:
xml.notes.value
xml.notes.note[0].name
xml.notes.note['note 1'].name
xml.notes.note[0].value
xml.notes.note['note 2'].value
XML2Object function coded by Mark Hicken (nekcih@yahoo.com)
@description return an object with the content of the XML translated to a Javascript object
NOTE: A node name with "-" or "." will be replaced with "_" for Javascript compatibility.
EXAMPLE: <FIRST-NAME> or <FIRST.NAME> will become FIRST_NAME
Most other special characters in tag names will break this translator.
NOTE: If a node has an id or name property then it will automatically be accessible via a hash key or via an array index.
EXAMPLE: <name id="name 1">Jon</name> could be accessed using name['name 1'] or name[0]
If a node has more than 1 child with the same name, an array is created with the children contents
The object created will have this structure:
obj {
nodeName (might be an array) : {
attributes : an object containing the node attributes
name : an string of the node name
value : an object containing the node contents
node : the object from which this node was built
}
EXAMPLE USAGE
myXML = XML2Object(XMLRootNode);