Re: Mozilla save method for xml ? anything new?

"rvj" <[email protected]> Fri, 21 Aug 2009 07:41:46 +0100
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
PPPS I managed to get the file to write using localfile rather than profile 
directory

   but probably the real problem wasVista security settings


"rvj" <[email protected]> wrote in message 
news:[email protected]...
>
> I did try saving to file using the httpxmlrequest + serializer using 
> example  code
> at https://developer.mozilla.org/en/Parsing_and_serializing_XML
>
> ....but I get  "ns_error_file_not_found" [x80520012] message during init()
>
> I'm not sure if this means an error file or the output file.
>
> Do you happen to know if the outputfile (dom.xml) has to exist before hand
> ....or is it deleted&created automatically ?
>
> *************************************************************
>
> var serializer = new XMLSerializer();
> var foStream = 
> Components.classes["@mozilla.org/network/file-output-stream;1"]
>               .createInstance(Components.interfaces.nsIFileOutputStream);
> var file = Components.classes["@mozilla.org/file/directory_service;1"]
>           .getService(Components.interfaces.nsIProperties)
>           .get("ProfD", Components.interfaces.nsIFile); // get profile 
> folder
> file.append("extensions");   // extensions sub-directory
> file.append("{5872365E-67D1-4AFD-9480-FD293BEBD20D}");   // GUID of your 
> extension
> file.append("dom.xml");   // filename
> foStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0);   // write, create, 
> truncate
> serializer.serializeToStream(doc, foStream, "");   // rememeber, doc is 
> the DOM tree
> foStream.close();
>
>
> ********************************************************
>
> PS
>
> dont you mean save()  is not part of DOM3 Load&Safe.?
>>>
>> load() is not part of DOM3 Load&Safe.
>> See https://bugzilla.mozilla.org/show_bug.cgi?id=494705
>> and https://bugzilla.mozilla.org/show_bug.cgi?id=155749
>>
>> Can't you use XMLHttpRequest/DOMParser/XMLSerializer?
>>
>
> PPS
>
> I would still be interested in knowing whether support for document.load 
> (and document.save) is only a temporary
> feature !!
> .
>