My problem :
Once data are properly saved (included in <html> </html> tag for
indicating the content type), I cannot retrieve my data by helping
with the parseFromStream method from nsIDOMParser object. Error comes
up :
<< JavaScript error:
line 0: uncaught exception: [Exception... "Component returned failure
code:
0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMParser.parseFromStream]"
nsresult:
"0x80070057 (NS_ERROR_ILLEGAL_VALUE)" >>
When i change charset value to "UTF-8" (instead of default "null"
value), error changes :
<< JavaScript error:
line 0: uncaught exception: [Exception... "Component returned failure
code:
0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMParser.parseFromStream]"
nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" >>
How can i fix this problem and make it possible to retrieving my
stored data…
You can directly write me a mail to doria...@free.fr
Excerpts of listing :
/*************************************/
Load = function()
/*************************************/
[…]
// open flag : readonly, permissions : read permission for local user
inputStream.init(currentFile,0x01,0400,0);
// purchase "text/html" stream content
var storedDocument =
streamParser.parseFromStream(inputStream,null,inputStream.available(),"text/html");
// error at this line !!!
[…]
/*************************************/
Store = function()
/*************************************/
[…]
mySerializer = new Serializer();
stringToSave = mySerializer.serializeToString(document);
// open an ouput stream
outputStream = new FileOutputStream();
// WriteOnly | Truncate, rwx permissions for local user
outputStream.init(currentFile,0x02 | 0x20,700,0);
// store content in currentFile
// mySerializer.serializeToStream(document, outputStream, "UTF-8");
outputStream.write(stringToSave,stringToSave.length);
[…]
/*************************************/
Stored data :
/*************************************/
<HTML>
<head> </head>
<body>
<div id = "contentarea" > blabla </div>
</body>
</HTML>
DOMParser only does XML. So the "text/html" is what's getting you the
NOT_IMPLEMENTED exception.
-Boris
Is there some other component that can be used from a chrome app to
parse HTML into a DOM tree?
erik
ps. If anyone else is interested the bug is:
http://bugzilla.mozilla.org/show_bug.cgi?id=102699
At the moment, no. The HTML parsing code makes all sorts of assumptions about
availability of things like window objects associated with the document being
parsed...
That's being worked on, last I checked (search on "html content sink" and
"docshell" in bug summaries?)
-Boris
Erik Arvidsson <http://webfx.eae.net/contact.html#erik> wrote in message news:<cerhag$in...@ripley.netscape.com>...
> If DOMParser only parse XML, why in that case documents about it indicate :
> "contentType: The content type of the string - either text/xml or text/html"
> (www.xulplanet.com)
> ???
See the comments at the bottom of the page:
http://xulplanet.com/references/objref/DOMParser.html
I havn't checked out creating a document fragment using the suggested
range's createContextualFragment function, but this would be interesting
if it would work.
Daniel
Dorian.
Daniel Kirsch <Iwillnotr...@gmx.de> wrote in message news:<cessft$jpj$06$3...@news.t-online.com>...