I am trying to figure out how the evalXPathToString
method should be coded to allow me to have xpaths with text()
at the end or not:
String xml = <xmlDoc><noele>junk</noele><valss>1.45</valss><other>junk2</other></xmlDoc>
assertThat(evalXPathToString(xml, "/xmlDoc/valss"), is("1.45"));
assertThat(evalXPathToString(xml, "/xmlDoc/noele"), is("junk"));
assertThat(evalXPathToString(xml, "/xmlDoc/other/text()"), is("junk2"));
Version 2.13 of vtd-xml.
EDIT for what I have:
autoPilot.selectXPath(xpath);
if(hasMoreElements(autoPilot)) {
int textIndex = vtdNav.getText() ;
if(textIndex != -1) {
return vtdNav.toNormalizedString(textIndex);
}
}
...but the final assert doesn't pass.