Re: [xml] XML streaming with libxml2



On Sun, Aug 31, 2003 at 02:22:06PM +0200, Alexander Demenshin wrote:
On Sun, Aug 31, 2003 at 06:46:31AM -0400, Daniel Veillard wrote:

 Misc* indicates that the parser cannot detect the end of the stream.
and finding "prolog element Misc* element" must generate a fatal error.

  So how I can use XML for streaming if I don't know the length of XML
  document in advance? I guess that XML doc may contain (theoretically)
  anything that I want to use as separator... Or I am wrong?

You must have a way to mark the end of the XML instance in your stream
detect it and tell the parser that the end was reached. If someone 
designed a stream of XML documents without marker boundaries, the design
is simply broken ! That simple...
You may use a special string in a comment at the end of each XML instance,
have the I/O layer detect them, and when passing data down to the XML
parser indicate the end of the stream based on this.
Misc can generate comments or PI, your pick.
But more generally DO NOT stack XML instances in a stream, find a way
to make and detect boundaries as the lower transport level.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]