Re: [xml] streaming XML



On Fri, Jul 30, 2004 at 09:40:27PM -0400, Bob Rossi wrote:
Hi,

I hope this isn't a silly question.

I was wondering if libxml is good at parsing streaming XML documents.
What I mean by this is, is libxml capable of recieving 1 char at a time,
and then telling if it is done parsing a document and the status of the
document? Or does it have to be given the whole document up front?

  libxml2 support streaming. There is 2 APIs: SAX and the reader for this.
I also support progressive parsing (i.e. chunk by chunk, progressive parsing
and streaming are different concepts).
BUT it *cannot* tell it is done parsing an XML document, no XML parser can
do that for the very simple reason that an XML document is defined by the
following grammar:

  http://www.w3.org/TR/REC-xml/#sec-well-formed
  [1] document ::= prolog element Misc*

The Misc* means the end of the root element is not the end of the document
and you cannot predict how many Misc element will be available. The environment
*must* tell the parser when the document is finished.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]