Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mozilla save method for xml ? anything new?

0 views
Skip to first unread message

rvj

unread,
Aug 15, 2009, 7:53:13 AM8/15/09
to

its been some while since the dom level 3 load and save spec was issued

.. but Mozilla still only supports the load() method ??


Whats happening


....or is there any best practice for implimenting document save()
functionality ??


Smaug

unread,
Aug 16, 2009, 10:11:07 AM8/16/09
to rvj
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?


-Olli

rvj

unread,
Aug 19, 2009, 4:10:48 AM8/19/09
to

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 !!
.


rvj

unread,
Aug 21, 2009, 2:41:46 AM8/21/09
to
PPPS I managed to get the file to write using localfile rather than profile
directory

but probably the real problem wasVista security settings


"rvj" <r...@rolemodels.net> wrote in message
news:_q2dncdy5YYRLhbX...@mozilla.org...

0 new messages