Maybe I did not make clear the solution I used.

It IS possible to parse an XML stream coming from a socket WITHOUT knowing 
its length.
What you need to do (I can post the code if you wish) is understanding the 
logical end of the
XML stream (the logical end is whan you go back to level Zero of the XML tree).

To do this you need to use a SAXDriver and use a custom ContentHandler class.
It works.

Damiano


At 12.36 21/06/2002 +0100, James Strachan wrote:
>From: "Ing. Damiano Bolla" <[EMAIL PROTECTED]>
> > Not really, reading from a socket you do not know whan the document is
>finished
> > You really need to use a SAXDriver to parse the data stream logically and
> > detect the logical end of file.
> > As far as I understand this is the only option available.
>
>Unfortunately an XML parser can never know when the document ends. After the
>last element tag there can be endless processing instructions or comments.
>e.g.
>
><foo>
><!-- end of docuemnt -->
><?foo a="123??>
>
>So when making XML servers you typically need to send the size first, then
>the document, so you know how far to read. e.g. like a HTTP GET or POST, the
>content length helps a client know how far to read on the stream.
>
>James
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com

Damiano Bolla, Director R&D, Infotech S.r.l





-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to