Hi Daniel,

I wonder if you mean by "Handling SAX events while parsing as  DOM".


Here is what I did:

1. Derive a class from BinInputStream, implementing the readBytes() and
curPos() methods.
2. Derive a class from  InputSource, implementing the only virtual function
makeStream(). Just create a new stream object on the heap and return its
pointer. It will be automatically destructed by Xerces, don't delete it.

3. Derive an error handler class from HandlerBase(I think this is optional)
4. Derive your own paser class from XercesDOMParser, override those virtual
functions you're interested in. For me, I care about endElement() only.
Inside those virtual  functions, you have full access to the DOM tree and
current element. One thing to remember is, never forget to call their
ancestors, if you want the parser to function normally.

5. After the parse finished, you can get the DOMDocument by calling
getDocument() method of the parser.

regards

Lei
----- Original Message -----
From: "Daniel Grillo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 11:09 PM
Subject: sax2 parser reading from a tcp socket


> Hi Folks,
>
> I've been browsing through the archives and it seems a few people have had
> some experience with creating input sources for their sax2 parsers from
tcp
> sockets.  I'm looking to do the same thing but I'm having trouble with
where
> to start.  I've looked at the Memparse example as a start, but it seems to
> want the complete document in the buffer which gets fed to the ".parse()"
> function.  I'm not going to have the complete document in a buffer, it
will
> be continually streamed in from the socket.  I thought receiving XML
through
> tcp would be a fairly common task but there doesn't seem to be any native
> support for it in the xerces inputsource objects.  Could anyone point me
at
> any code examples of tcp input being done with a sax2 parser?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to