Software engineering notes

playing with e4x in firefox: accessing attributes

<script>
/*
ref: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Processing_XML_with_E4X
ref: http://bit.ly/y8udj
prereq: firefox w/ firebug installed
1) put this code in an html file
2) run it in firefox
3) look for output in console
*/
var xml = <parent>
	<children>
		<child name="julio"/>
		<child name="juan"/>
		<child name="jose"/>
	</children>
</parent>;
console.log(xml.children.child[0].@name);
</script>

Written by Erik

May 21, 2009 at 7:11 pm

Posted in tutorial

Tagged with , ,

%d bloggers like this: