Strictly speaking, if you want to handle any XML document over your stream
you must use some protocol to specify how long the XML document is.
According to the XML specification it is not possible to just terminate XML
parsing when the last close element occurs.

The way things like SOAP work is by using transport protocols like HTTP
which sends the length of the document first, then the document. Then the
InputStream can just read n bytes and know its got to the end of the
datagram.

http://www.mail-archive.com/dom4j-user%40lists.sourceforge.net/msg01031.html

e.g. this stream of XML data grams will probably break any generic solution,
thats not clever enough to spot the 2nd XML declaration...

<foo>document 1</foo>
<!-- this is a comment in document 1-->

<?xml version="1.0"?>
<bar>this is document 2. Note the line above must be the first line or the
parsing will fail
so the comment from document 1 could well break the parse of this document
</bar>


James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Cory C. Omand" <[EMAIL PROTECTED]>
To: "DOM4J User Alias" <[EMAIL PROTECTED]>
Sent: Tuesday, October 22, 2002 1:36 AM
Subject: [dom4j-user] Processing Multiple XML Datagrams


> I am attempting to process a number of XML datagrams that are coming back
from a web service.  Essentially, there are multiple full XML documents
being returned as one stream, and I would like to create a Document for each
of them.  Can anyone give me a pointer as to where I should start looking?
I was thinking that some sort of SAX reader could separate each datagram
into a String object, and then I could use the SAXReader.read(String) method
to construct a Document object.  Does anyone here have experience doing
something like this?  If so, I would appreciate a pointer in the right
direction...
>
> Thanks in advance,
> C.
>
>
>
>
> -------------------------------------------------------
> This sf.net emial is sponsored by: Influence the future
> of  Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
>
http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to