Hi chaps and chapesses,
I’m trying to display an XML attribute, but I’m having no luck - can anyone help me navigate the object properly?
this is the simple xml file (which i found it in one of Senocular’s examples):
‘<‘LETTER’>’
‘<‘TO’>‘Sandy’</‘TO’>’
‘<‘FROM’>‘Joseph’<’/FROM’>’
‘<‘BODY’>‘I love you!’<’/BODY’>’
‘<’/LETTER’>’
this is my as:
// create XML object
var xmlDoc = new XML();
xmlDoc.onLoad = parseXML;
// load the xml doc
xmlDoc.load("test.xml");
function parseXML( success )
{
if( success )
{
// outputs all the tags
trace( this.firstChild );
// outputs the tag: LETTER
trace( this.firstChild.nodeName);
// outputs the tag: TO
trace( this.firstChild.firstChild.nodeName );
// outputs the tag: TO & its value
trace( this.firstChild.firstChild );
}else{
trace("error");
}
}
that’s as far as I’ve got
I’m tryig to figure out how to output the rest of the tags - (FROM & BODY)
are they stored in an object following the firstChild.firstChild?
cheers