posted 21 years ago
I have a HTML page and a JavaScript file. In the JavaScript file I'm trying to load an XML file to be handled via DOM. It's quite simple. The problem is how to do it in NetScape?
I took a look at some articles and found the following script:
var XMLDocument = document.implementation.createDocument("", "", null);
XMLDocument.load("NomeDoArquivoXML");
It should work well, but it does not.
Maybe there is missing some parameter in the createDocument method.
Bellow is the snippet I coded:
/** This function creates an XML document and loads it with values passed by "XMLString" */
function loadXML(XMLString, IsFreeThreaded)
{
var XMLDocument = (IsFreeThreaded) ? new ActiveXObject("MSXML2.FreeThreadedDomDocument") : new ActiveXObject("MSXML2.DomDocument");
XMLDocument.validateOnParse = true;
XMLDocument.async = false;
if ((XMLString != null) && (XMLString != ""))
{
XMLDocument.loadXML(XMLString);
}
return XMLDocument;
}
/** This function creates an XML document and loads it with values contained in the XML file called "XMLFile". */
function loadXMLFile(XMLFile, IsFreeThreaded)
{
var XMLDocument = (IsFreeThreaded) ? new ActiveXObject("MSXML2.FreeThreadedDomDocument") : new ActiveXObject("MSXML2.DomDocument");
XMLDocument.validateOnParse = true;
XMLDocument.async = false;
XMLDocument.load(XMLFile);
return XMLDocument;
}
I'm I doing the right thing?
Suggestions will be welcome.
Thanks!
Luciano Queiroz
<b>Luciano Queiroz</b><br/>
Brazil<br/>
<i>SCJP 1.2, SCWCD, IBM 141, IBM 483, SCJP 1.4, IBM 484, IBM 287, SCBCD, SCEA, SCJP 5.0, SCJP 6.0, SCWCD 5</i>