OK here's a stupid question (XML/DOM/XMLHttpRequest)
In IE, once you instantiate the XML DOM parser you can load a text string containing XML this way:
parser.loadXML(string);
This is great since I can take the response from an XMLHttpRequest and just load it into the parser as if it were an existing xml file (something both IE and Mozilla support with the .load() method of the parser).
I've been poring through Mozilla documentation for half an hour now, and I can't find an equivalent function in the Mozilla XML DOM parser. What the hizzy? How do I do this in Mozilla?
Mark I just use:
response = req.responseXML.documentElement;
where req is the XMLHttpRequest object... you can then just say:
result = response.getElementsByTagName('result')[0].firstChild.data;
or whatever other DOM commands you want to issue.
This works in both browsers btw.
Phil
January 12th, 2006
Neat.
I had a suspicion that it was simpler than the tut I was reading. :P
If what you were looking for was to actually create an XML doc from a string (rather than from a download), you could something like this ....
xmlParser = new DOMParser();
xmlDocument = xmlParser.parseFromString(string, 'text/xml');
slava
January 12th, 2006
"There are no stupid questions, only stupid people."
(g,d,r)
Anonymous A-Hole
January 12th, 2006