Search code examples
xmlvtd-xml

get the line number of xml using vtd-xml


is there a way to get the line number of an xml, when navegating it with VTDNav of VTD-XML? I have the VTD position of the node (with vn.getCurrentIndex()) but I can't find a way to get the line number where it is

Thanks in advance


Solution

  • If you have access to source code, VTDGen has a method that does the line number reporting... you can hack that code into your VTDNav navigation code...

    As to the request of adding it to the main VTDNav method (if that is what you have in mind)... I will have to deny it for the following reasons:

    1. It is a niche feature at most
    2. It is variable cost cycle-wise, potentially very expensive.. Having this method easily accessible makes it easier to write slow code,potentially defeating the purpose of using vtd-xml in the first place
    3. It bloats the core API.