public static String getXpathValue(String xpath, AutoPilot ap) throws XPathParseException { ap.selectXPath(xpath); return ap.evalXPathToString(); }
searchOption.name = name.evalXPathToString(); Log.e("SearchId", Id.evalXPathToString()); Log.e("SearchName", name.evalXPathToString()); pro.id = Id.evalXPathToString(); Log.e("SearchPId", Id.evalXPathToString()); Log.e("SearchPName", name.evalXPathToString()); searchOption.propertyList.add(pro);
/** * Returns the value of <tt>xpath</tt> as retrieved when calling * {@link AutoPilot#evalXPathToString()}. * * @param xpath * The XPath for which a value should be returned. * @return The XPath value. * @throws XPathParseException * @throws XPathEvalException * @throws NavException */ protected Optional<String> getXPathValue(String xpath) throws XPathParseException, XPathEvalException, NavException { try { vn.push(); AutoPilot ap = getAutoPilot(xpath, vn); String xpathValue = ap.evalXPathToString().trim(); if (xpathValue != null && xpathValue.length() > 0) return Optional.of(xpathValue); return Optional.empty(); } finally { releaseAutoPilot(); vn.pop(); } }
import com.ximpleware.*; public class concatTest{ public static void main(String s1[]) throws Exception { VTDGen vg= new VTDGen(); String s = "<users><user><firstName>some </firstName><lastName> one</lastName></user></users>"; vg.setDoc(s.getBytes()); vg.parse(false); VTDNav vn = vg.getNav(); AutoPilot ap = new AutoPilot(); ap.selectXPath("concat('good', ' luck')"); System.out.println(" concat output ==>"+ap.evalXPathToString()); ap.selectXPath("concat(/, '')"); ap.bind(vn); System.out.println(" concat output ==>"+ap.evalXPathToString()); } }
AutoPilot ap = new AutoPilot(vn); ap.selectXPath(this.entityIdentifierXpath); String entityIdentifier = ap.evalXPathToString(); String entityLastUpdated = ap.evalXPathToString();
retList.add(options.resolveEntities ? vn.toString(offset, length) : vn.toRawString(offset, length)); } else { retList.add(apXP.evalXPathToString());
ap.bind(document); ap.selectXPath(group.getTimestampXpath()); String value = ap.evalXPathToString(); document.pop();
ap.bind(resource); ap.selectXPath(key); keys.add(ap.evalXPathToString()); resource.pop(); ap.bind(resource); ap.selectXPath(group.getKeyXpath()); String s = ap.evalXPathToString(); resource.pop();
void updateProjectParentVersion(MavenProject project, Version version) throws MojoExecutionException { try { VTDGen gen = new VTDGen(); gen.enableIgnoredWhiteSpace(true); gen.parseFile(project.getFile().getAbsolutePath(), true); VTDNav nav = gen.getNav(); AutoPilot ap = new AutoPilot(nav); ap.selectXPath("namespace-uri(.)"); String ns = ap.evalXPathToString(); nav.toElementNS(VTDNav.FIRST_CHILD, ns, "parent"); nav.toElementNS(VTDNav.FIRST_CHILD, ns, "version"); int pos = nav.getText(); XMLModifier mod = new XMLModifier(nav); mod.updateToken(pos, version.toString()); try (OutputStream out = new FileOutputStream(project.getFile())) { mod.output(out); } } catch (IOException | ModifyException | NavException | XPathParseException | TranscodeException e) { throw new MojoExecutionException("Failed to update the parent version of project " + project, e); } }
result = apLinkPath.evalXPathToString(); if (result == null || result.isEmpty()) { switch(ld.getIfLinkPathMissing()) {
while (apPunct.evalXPath() != -1) { apEvalToString.resetXPath(); String punct = apEvalToString.evalXPathToString(); collectPunct(tagsAndPunct, punct); String tokenPositionId = apTokenPositionId.evalXPathToString(); tokenPositionsMap.put(tokenPositionId, getCurrentTokenPosition()); while (apTokenPos.evalXPath() != -1) { apEvalToString.resetXPath(); String tokenPositionId = apEvalToString.evalXPathToString(); Integer integer = tokenPositionsMap.get(tokenPositionId); if (integer == null)
ap.bind(document); ap.selectXPath(object.getXpath()); String value = ap.evalXPathToString(); document.pop();
String fieldName = apFieldName.evalXPathToString(); apMetadata.resetXPath(); String metadataValue = apMetadata.evalXPathToString(); metadataValue = processString(metadataValue, f.getProcess()); ConfigMetadataField metadataField = b.getField(fieldName); } else { String metadataValue = apMetadata.evalXPathToString(); metadataValue = processString(metadataValue, f.getProcess()); addMetadataField(f.getName(), metadataValue);
keyName= ap3.evalXPathToString(); vn.push(); while((j=ap4.evalXPath())!=-1){
for (String captureValuePath: annotation.getCaptureValuePaths()) { AutoPilot apCaptureValuePath = acquireAutoPilot(captureValuePath); String value = apCaptureValuePath.evalXPathToString(); releaseAutoPilot(apCaptureValuePath); valuePath = valuePath.replace("$" + i, value); String name = apName.evalXPathToString(); apValue.resetXPath(); String value = apValue.evalXPathToString(); value = processString(value, subAnnot.getProcess()); ConfigAnnotation actualSubAnnot = annotation.getSubAnnotation(name);
while (apValuePath.evalXPath() != -1) { apEvalToString.resetXPath(); String annotValue = apEvalToString.evalXPathToString(); annotValue = processString(annotValue, annotation.getProcess()); if (subAnnot == null) String annotValue = apValuePath.evalXPathToString(); annotValue = processString(annotValue, annotation.getProcess()); if (subAnnot == null)