I am trying to load XML document in the browser from a JavaScript
variable. The
reason is when I create XML document from a Database I don't want
to store it
on a disk and then load from a disk, I just want to pass it to a
browser as a
string/variable.
Well, I know how to do it in IE: by using xmlDoc.loadXML method
like in example
below
var xmlStr = "<CAT><CD><TITLE>Empire</TITLE><ARTIST>Bob
Dylan</ARTIST></CD><CD><TITLE>Hide</TITLE><ARTIST>Bonnie</ARTIST></CD></CAT>";
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = tmp;
xmlDoc.loadXML(xmlStr);
function tmp()
{
if (xmlDoc.readyState == 4) generateFromXML();
}
function generateFromXML()
{
// processing code
// ...
}
In Netscape 6 I use:
var xmlStr = "<CAT><CD><TITLE>Empire</TITLE><ARTIST>Bob
Dylan</ARTIST></CD><CD><TITLE>Hide</TITLE><ARTIST>Bonnie</ARTIST></CD></CAT>";
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = generateFromXML;
xmlDoc.loadXML(xmlStr);
function generateFromXML()
{
// processing code
// ...
}
Well, xmlDoc.loadXML(xmlStr) doesn't work.
Does anybody know how to do the same thing in Netscape 6?
---------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: Loading XML document as a string from Ja... lakshmikant panchal
- Re: Loading XML document as a string fr... David N Bertoni/Cambridge/IBM
