Steve Clark wrote:
>
> [EMAIL PROTECTED] wrote:
>
> > I'm making a speaking web browser using Mozilla as a college project. I
> > have the XPCOM framework between the browser and the Text-To-Speech
> > engine set up but what I need to do now is get a hold of the currently
> > displayed HTML document so that it can be sent to the TTS engine for
> > speech generation. I'll be converting the HTML to "speakable" text
> > within the component, so what I really need now is a way of getting a
> > hold of the doc from C++.
>
> Depends what you mean by the "doc." Do you literally want the
> nsIDocument object, from which you can enumerate all of the content
> nodes in the content tree yourself? Or do you want a serialized
> representation of the text in the document (omitting the structure?) Do
> you want the state of the document included, so that any dynamic
> manipulation and style interpretation has the intended effect? If so,
> you certainly don't want to go anywhere near the cache, which holds the
> document in its "raw" form. In general, I'd look how we handle the save
> and copy operations, and suggest that you grab your data in a similar
> fashion.
>
> > There must be a pointer or handle or
> > something to it somewhere right? I mean, it has to be in the cache so
> > it must be copyable (yes?!?) Anyway, after I get that problem out of
> > the way, my project is pretty easy so I'd love any suggestion,
I don't know how far you want to go with your college project, but you
may wish to look into aural style sheets:
http://www.w3.org/TR/REC-CSS2/aural.html
Mozilla currently supports the screen and print media types. Basically,
the document is parsed to form a "content model" (basically, DOM
(Document Object Model)), and then style sheets are applied to the
content to form a "frame model" (basically, the CSS box model). These
frames are then presented to the user via the "view model".
In the aural case, you probably need to apply an aural style sheet to
the content model to form an aural model that can be presented to the
user via speakers/earphones/etc.
Erik