You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Coursimault, Jean-marc" <Co...@xrce.xerox.com> on 2002/01/23 10:34:50 UTC

Finding the byte offset of an event in the input stream

Hello all,

I'm trying to find the exact byte offset (in the input stream) of each event
reported by the Sax parser, i.e. "the tag <xyz> begins at the n-th character
of the input file" 

I see that there is a Locator object that is supposed to return the line and
column of an event : but I don't understand neither the "line and column"
idea - to me the document is only a stream of bytes (or possibly Unicode
characters) - , nor exactly how to implement this object.

In the InputDataStream::readBytes function, I read the input data by chunks,
as requested, and I cannot therefore maintain a byte count to where
precisely the parser is. I guess that the parser needs to read a lot of data
(perhaps all) in advance too.

If I use parser->getScanner()).getSrcOffset(), I get values that seem
unrelated to the actual input.

I've read the docs and FAQ , I've traced this function to
XMLReader::getSrcOffset() and I'm stumped.

Any help would be greatly appreciated.
Thanks in advance


-- Jean-Marc
____________________________________________________________
Jean-Marc Coursimault         |
Xerox Research Centre Europe  | Tel   +33 (0)4 76 61 51 82
Advanced Technology & Systems | Fax   +33 (0)4 76 61 51 99
6, chemin de Maupertuis       |  
38240 Meylan (France)         | coursimault@xrce.xerox.com
 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org