Is it possible to track the file pointer (document position) using the XML API?
I want to index an XML file by the ids of its main level records. I am planning to parse the entire document, extract the id from the post and index it (remember the file position of the opening tag <
and the position of the closing tag >
+ 1). Later, this will allow me to quickly find this place by ID.
But is it possible to track the position of a file using SAX?
If this is not possible with SAX, then is there some other parser for it?
UPDATE
I found that Location has a method getCharacterOffset()
. Is this the meaning StAX
?
UPDATE 2
Location
works, but somehow unexpectedly. The first tag mediawiki
and starts at zero. getCharacterOffset()
Returns 4 at the same time from the start of processing.
It looks like what is in front in front.
source to share
No one has answered this question yet
Check out similar questions: