I am receiving an HTML fragment from the server as a response from an XmlHTTP request. I would like, if possible, to avoid using the innerHTML property to append the fragment to the document. I have therefore loaded the reponse into an XML Dom object (created with createDocument) and appended this to the HTML DOM.

The problem, while it appends the information to the element, only the text is appended and none of the HTML is parsed, resulting in just a concatonated string. For some reason, the browser ignores any of the markup.

This seems to be the case in both the DOM compliant browsers I have tested the code in (Firefox and Netscape). So I am thinking that this is a feature of the DOM API rather than a bug. If indeed this, is the case, how do I get the DOM to recognise the XML I am appending as XHTML.

Below is the Javascript I am using to append the HTML fragment.
	var transformed = '';
	var oXml = loadXmlFromString(xmlHTTP.responseText);

	if (window.ActiveXObject) { // Internet Explorer
		bookSummary.innerHTML = oXml.xml;
	} else if (oXml.documentElement){ // w3c compliant browsers
		if (bookSummary.firstChild) {	
		} else {

function loadXmlFromString(sXml)

	var oXml = getXML();

	if (window.ActiveXObject) { // Internet Explorer
		return oXml;	
	} else if ((typeof DOMParser) != "undefined") { // w3c Compliant Browsers
		var parser = new DOMParser();
		var ret = parser.parseFromString(sXml, 'text/xml');

		return ret;

	throw 'Cannot load XMl from string';

function getXML()
	return document.implementation.createDocument('', '', null);