Well - I felt good when I came up with the following... (gFile being my nsILocalFile object from file picker) ----
const MODE = 1; const PERM = 00644; const nsIFileInputStream = Components.interfaces.nsIFileInputStream; const FILEIN_CTRID = "@mozilla.org/network/file-input-stream;1";
var is = Components.classes[FILEIN_CTRID].createInstance(nsIFileInputStream);
is.init(gFile, MODE, PERM, 0);
var parser = new DOMParser();
var xmlDoc = parser.parseFromStream( is, "UTF-8", is.available(), "text/xml");
----
But even for the simplest document ( eg <doc></doc> ) I get
XML Parsing Error: no element found Location: chrome://tortuga/content/tortuga.xul Line Number 1, Column 1: ^
Nothing is thrown, is.available() returns the file size on disk, permissions on disk look ok.
Any ideas ?
_______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom
