...

View Full Version : Importing XML into an XHTML document



smeshy123
05-26-2005, 09:04 AM
Ok, so here is my probelm. I am attempting to create a website that uses XHTML, and I would like to import my contents onto every page of the website from its own XML or XHTML file, how do I go about doing that? I have some JavaScript code I got out of a book but I don't understand it. And it does not work.



<script language="JScript" type="text/javascript">
try {
var objXMLDOM = new ActiveXObject("Msxm12.DOMDocument.3.0");
objXMLDOM.load("contents.xml");
}
catch (e)
{
document.write("An exception was raised.");
}
</script>


So I figured I would post this here, because there must be a JavaScript way to do this that works!

Thanks!

Smesh

jbot
05-26-2005, 04:26 PM
well, using JS is not the right way to go about this, for a start, since what happens if users don't have JS installed or enabled - nothing, because they can't use your site. best way is to transform your XML serverside, then it will work in all browsers. the code you've got is Win-IE only anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum