First, here's an xml document that I'm creating in javascript. I have it working, but I think it's inefficient and is not using the right way of doing things.\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <sheets> <sheet r:id="rId3" sheetId="1" name="Album List"/> </sheets></workbook>\[/code\]The code I'm using to create the actual xml document is this:\[code\]createXmlDoc: function (ns, base) { if(document.implementation && document.implementation.createDocument) { return document.implementation.createDocument(ns || null, base, null); } else if (window.ActiveXObject) { var doc = new ActiveXObject( "Microsoft.XMLDOM" ); var rootNode = doc.createElement(base); rootNode.setAttribute('xmlns', ns); doc.appendChild(rootNode); return doc; } throw "No xml document generator";}\[/code\]I'm calling it like this:\[code\]util.createXmlDoc(util.schemas.spreadsheetml, 'workbook')\[/code\](util.schemas.spreadsheetml is "http://schemas.openxmlformats.org/spreadsheetml/2006/main")So this gives me my XML document. Here's where it gets funky. I have to add a namespace to the document besides the main one, so I end up doing..\[code\]var wb = doc.documentElement;wb.setAttribute('xmlns:r', util.schemas.relationships);\[/code\](util.schemas.relationships is 'http://schemas.openxmlformats.org/officeDocument/2006/relationships')I'm pretty sure I'm doing this wrong, because when I turn it to an XML string in Firefox, every single element has xmlns="" as a tag on it, which causes Excel to barf (probably for good reason). On IE9 it's even worse -\[code\]<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:NS1="" NS1:xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <sheets xmlns=""> <sheet name="Album List" sheetId="1" xmlns:NS2="" NS2:r:id="rId3" /> </sheets></workbook>\[/code\]The only way I got the thing working was by regexing out the 'bad' stuff so that Excel would take it again. Can someone help me get this straightened out? Oh, and the project I'm working is not and cannot be jQuery dependent, so jQuery isn't an option here.