[sourcecode language=‘javascript’]

/* ref: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Processing_XML_with_E4X ref: http://bit.ly/14GnLT prereq: firefox w/ firebug installed note: if there is no pre-existing ‘child’ element, using ‘+=’ operator will append ‘child’ to ‘parent’, not ‘children’

  1. put this code in an html file
  2. run it in firefox
  3. look for output in console */ var names = [‘julio’,‘juan’,‘jose’], xml =

; for(var i = 0; i < names.length; i++) { //check for pre-existing ‘child’ if(xml.children.child){//if there, append xml.children.child += ; }else{//create initial ‘child’ element xml.children.child = ; } } console.log(xml);

[/sourcecode]