Simon Willison: Javascript, the DOM and application/xhtml
"when dealing with XML documents Gecko needs you to use document.createElementNS in place of document.createElement when manipulating the DOM."