My purpose :
I wish to store document (or node) data in a file,
then retrieving those data anytime i want,
and update this document (or node).
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 dorian.d...@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>