I want to know which XML parser in java (if at all) can provide me the byte offset of an xml element it parses.
I am using Lucene to index my XML files and when I search a paricular word I need the output to include the XML Element , file name as well as the byte offset so that I can seek quickly to that offset.
Have a look at VTD-XML: http://vtd-xml.sourceforge.net, the
VTDNav.getContentFragment()encodes the offset and length of an element: javadoc.You get the offset by casting it into an int
(int) VTDNav.getContentFragment().