Re: [xml] Getting the offset of a node in the stream



On Mon, Aug 10, 2009 at 08:56:33AM +0300, Alberto Mardegan wrote:
Michael Ludwig wrote:
Alberto Mardegan schrieb:

  I'm using an xmlTextReader (and the xmlTextReaderNext() function) to
read an XML file, and once I find a specific element I must be able to
tell at what byte offset in the file this element is found.
[...]
Second, do you really have to take such a low-low-low-level approach?
That might well be that case; but if not, there might be easier ways to
solve the problem.

It's soon explained: I'm writing a C library that needs to parse some XML 
files (only part of them, till it finds a certain element), and a Qt 
wrapper for the same library. The wrapper library doesn't need to parse 
the initial part of the document, but only from the same element where 
the C library stopped parsing.

  From an XML standard POV this makes absolutely no sense. Parsing is
defined *per document* you cannot parse one harf in one process and
the other half somewhere else. The only solution is to keep the same
parser and pass it over. Any other way is garanteed to fail in baroque
ways, you just can't do that ! Or you parse everything twice ...

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]