Re: Modification of a XMLDocument root
Emmanouil Batsis <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Hanh-Missi Tran wrote: > Hi > > I am writing a Firefox extension and I need to display a XML Document > created from a XML String. > I do not want to create a file that contains this XML String and to load > this file. > Thus my idea (the only one I found) is to have a simple XML file in my > extension, to load it via a chrome address and then to modify the > XMLDocument. > The code looks like: > window._content.document.removeChild(window._content.document.documentElement); > > window._content.document.appendChild(aNewXmlElement); > > However, the page is empty. Um, no error? What does the DOM Inspector show? Either the XML is there or an error occured. Anyway, what is the type of window._content.document (just use alert(window._content.document) and let us know the result)? I'm pretty sure you can either set it directly using the DOMParser (as with any XMLDocument, if that is what it is) or window._content.document.appendChild(window._content.document.importNode(myDoc.documentElement, true)) hth, Manos