I recently tried upgrade from 2.11 to 2.13 (I previous tried to upgrade to 2.12, but other issues caused me to revert back to 2.11) and found that I was getting failing unit tests.
On further inspection I tracked it down to the the AutoPilot class, when a default namespaced xpath search is performed it seems to take the lack of a namespace to be a wildcard for any namespace rather than just for the current default namespace.
I checked the expected outputs against http://www.freeformatter.com/xpath-tester.html with the xml:
<a xmlns:x="urn:test">
<b id="1"/>
<x:b id="2"/>
<b id="3"/>
</a>
and the path "//b" which results in the expected two elements as I expected - for both version 2.12 and 2.13 of the AutoPilot class we get all three child elements of a.
I have created a JUnit test that shows the issue and uploaded as a Gist:
VtdAutoPilotXpathIssueTest.java (gist.github.com)
vtd-xml 2.12 onward has a change in the behavior of matchElement() for VTDNav. based on user input/suggestion... the suggestion is to make the navigation behavior consistent with DOM when namespace awareness is turned off...
I will come up with a fix as ap for you ...
Can you do a build yourself with the update vtdNav.java? The URL below...
http://vtd-xml.cvs.sourceforge.net/viewvc/vtd-xml/ximple-dev/com/ximpleware/VTDNav.java
Thanks, that seems to fix the issue for me.
Looking at the code I am not sure whether
matchElement_IgnoreCasealso needs a similar fix as it does not checknsand callsmatchRawTokenString2_IgnoreCaseonly.good point, will look into that... in the meaning time, 2.13 is a big step forward from 2.11 in every way... just you know