How can I create a xml document using javascript and populate it with
content?
With Mozilla, Opera and Safari you can use the W3C DOM Level 2 Core API
to create an XML DOM document and manipulate it:
var xmlDocument = document.implementation.createDocument('', 'root',
null);
var foo = xmlDocument.createElement('foo');
foo.appendChild(document.createTextNode('bar'));
xmlDocument.documentElement.appendChild(foo);
With IE you need to use e.g.
var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
xmlDocument.appendChild(xmlDocument.createElement('root'));
var foo = xmlDocument.createElement('foo');
foo.appendChild(document.createTextNode('bar'));
xmlDocument.documentElement.appendChild(foo);