Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
stream problems when using nsIDOMParser
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dorian D.  
View profile  
 More options Aug 4 2004, 1:48 pm
Newsgroups: netscape.public.mozilla.dom
From: diktaf...@hotmail.com (Dorian D.)
Date: 4 Aug 2004 10:48:53 -0700
Local: Wed, Aug 4 2004 1:48 pm
Subject: stream problems when using nsIDOMParser
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>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile  
 More options Aug 4 2004, 1:55 pm
Newsgroups: netscape.public.mozilla.dom
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Wed, 04 Aug 2004 12:55:41 -0500
Local: Wed, Aug 4 2004 1:55 pm
Subject: Re: stream problems when using nsIDOMParser

Dorian D. wrote:
> streamParser.parseFromStream(inputStream,null,inputStream.available(),"text /html");    

DOMParser only does XML.  So the "text/html" is what's getting you the
NOT_IMPLEMENTED exception.

-Boris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Arvidsson  
View profile  
 More options Aug 4 2004, 4:35 pm
Newsgroups: netscape.public.mozilla.dom
From: Erik Arvidsson <http://webfx.eae.net/contact.html#erik>
Date: Wed, 04 Aug 2004 22:35:28 +0200
Local: Wed, Aug 4 2004 4:35 pm
Subject: Re: stream problems when using nsIDOMParser

Boris Zbarsky wrote:
> DOMParser only does XML.  So the "text/html" is what's getting you the
> NOT_IMPLEMENTED exception.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile  
 More options Aug 4 2004, 4:43 pm
Newsgroups: netscape.public.mozilla.dom
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Wed, 04 Aug 2004 15:43:41 -0500
Local: Wed, Aug 4 2004 4:43 pm
Subject: Re: stream problems when using nsIDOMParser

Erik Arvidsson wrote:
> Is there some other component that can be used from a chrome app to
> parse HTML into a DOM tree?

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dorian D.  
View profile  
 More options Aug 5 2004, 4:41 am
Newsgroups: netscape.public.mozilla.dom
From: diktaf...@hotmail.com (Dorian D.)
Date: 5 Aug 2004 01:41:36 -0700
Local: Thurs, Aug 5 2004 4:41 am
Subject: Re: stream problems when using nsIDOMParser
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)
???


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Kirsch  
View profile  
 More options Aug 5 2004, 4:52 am
Newsgroups: netscape.public.mozilla.dom
From: Daniel Kirsch <Iwillnotread_dan...@gmx.de>
Date: Thu, 05 Aug 2004 10:52:41 +0200
Local: Thurs, Aug 5 2004 4:52 am
Subject: Re: stream problems when using nsIDOMParser

Dorian D. wrote:
> 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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dorian D.  
View profile  
 More options Aug 5 2004, 3:06 pm
Newsgroups: netscape.public.mozilla.dom
From: diktaf...@hotmail.com (Dorian D.)
Date: 5 Aug 2004 12:06:09 -0700
Local: Thurs, Aug 5 2004 3:06 pm
Subject: Re: stream problems when using nsIDOMParser
I finally followed your advises and I used createContextualFragment...
Thanks you very much, it works perfectly... in this manner, i didnt
even use
nsIDOMParser.parseFromStream which is a real mess. Finally, i can load
and store div content quasi instantly by putting or taking off
fragments from my document : really nice !

Dorian.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »