Re: [xml] loading concatenated documents



On Sun, Mar 28, 2010 at 07:27:07PM -0400, Ethan Tira-Thompson wrote:
Hi all,

I'd like to load a series of concatenated XML documents (it's a stream of sensor packets from a simulation).

 Broken design:

http://www.w3.org/TR/REC-xml/#NT-document

[1]     document       ::=       prolog  element  Misc*

since the production terminates with Misc*, an XML parser cannot detect
the end of a document on its own, this has to come from the environment.
The only correct way would be to put some kind of marker in the input
stream and have a input preprocessing layer detect them and then feed
the parsers the right size.
This is not solvable at the XML parser level itself. You may be able to
do tricks, like loading the whole set as a well balanced chunk, or play
dynamically with the input as you're suggesting, but this can't be made
reliable, and completely depends on the actual documents being sent and
the expectation that the producer doesn't make some kind of errors, so
useless in the general case. I'm afraid you're on your own due to a
complete design failure.

  NEVER STACK XML DOCUMENTS

at least without some separation markers or associated records of their
size.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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