Trying to display an xml attribute

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

<LETTER>
<TO>Sandy</TO>
<FROM>Joseph</FROM>
<BODY>I love you!</BODY>
<
/LETTER>

forgot the end tags for the TO and FROM :wink:

take out the "*"s too. :slight_smile:

cheers froZenX,

but the html is fine (the tags are a little messed up in my post because I was trying to isolate them using ‘’, as i didn’t know you could use *)

anyway, assume the xml file is fine

what I’m trying to get right is the as

cheers
:slight_smile: