How do you create a new html dom document? So here’s the situation. I have a string that is returned from an xmlHTTPRequest, and I need to create a document from it, manipulate the dom, and then turn it back into a string.(I know this sounds silly but I have to do this) I can create an xml document using the function below:
function parseXMLTextToDOMDocument(xmlText) {
// uses browser detection
if (browser == ‘ie’) {
var doc = new ActiveXObject(“Microsoft.XMLDOM”);
doc.async=”false”;
var text = xmlText;
doc.loadXML(text);
}
return doc;
}
This will give me an xml document, which means I cannot use things such as doc.documentElement.className;
I need an html document to use className in this way. How do I do this? I thought perhaps I should use something like
doc = new HTMLDocument()
doc.write(string)
Perhaps there is a create html dom document function that I do not know about. Should I use a document fragment? help!!!!