Re: XMLDocument.save("localfile.xml") <possible solutions>
Lucky <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
Lucky wrote: > Christian Biesinger wrote: >> Lucky wrote: >>> if (!localFile.exists()) >>> localFile.create(localFile.NORMAL_FILE_TYPE, 0644); >> >> This is not needed as you pass PR_CREATE_FILE (0x08) to init. >> >>> outputStream.init(localFile, 0x04 | 0x08 | 0x20, 0644, 0); >> >> not sure why this uses PR_RDWR (0x04) rather than PR_WRONLY (0x02)... >> >> As for the second variant: >> >>> (new XMLSerializer).serializeToStream(this, os, charset); >> >> This doesn't work, does it? The converter output stream is not an >> nsIOutputStream... > both seem to produce a valid file, but will test further. > i just pieced together some examples, so i'm trying to find the > BEST/SIMPLEST code that will achieve the results needed :) > > by all means, unnecessary steps should be eliminated. ok, my testing was quick and flawed, and it did not save out.