Re: Using XML dom in javascript in Firefox, Request for sample code
R_O_O_K <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Aster City Cable |
| Message-ID | <[email protected]> |
Hi!
Here's an exaple using XMLHTTPRequest to send a POST query to the
server, recieve an XML file and later on an appropriate XSLT Stylesheet
and transform the acqiured XMLDoc.
var xmlDoc = new XMLHttpRequest();
var xslTra = new XMLHttpRequest();
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalBrowserRead"
);
xmlDoc.open("POST", URL, false);
xmlDoc.setRequestHeader(
"Content-Type",
"application/x-www-form-urlencoded");
);
xslTra.overrideMimeType("text/xml");
xmlDoc.send("POST QUERY U WANT");
xslTra.open("GET", XSLTURL, false);
xslTra.overrideMimeType("text/xml");
xslTra.send("");
var proc = new XSLTProcessor();
proc.importStylesheet(xslTra.responseXML);
var ndoc = proc.transformToFragment(
xmlDoc.responseXML.documentElement,
doc
);
As regards the DOM, Mozilla follows
http://www.w3.org/TR/DOM-Level-2-Core/
closely (same with XPath, HtmlDom, etc.)
so w3c docs are good reference
Michal Ziemski
Dnia 2004-06-17 13:59, Użytkownik Jiri Znamenacek napisał:
> Gary van der Merwe wrote:
>
>> I have a IE supported DHTML/XML application, and would like it to work
>> in Firefox. Could you please point me to some sample code which can
>> download xml files in javascript, use the fetures of the dom, and post
>> xml to server.
>
>
> http://mozilla.org/xmlextras/
>
> Well, maybe not the best but close to the origin ^_-
> JZ