public String asPath() { return this.pointer.asPath(); } }
public static String convertPath(Pointer pointer) { String pointerPath = pointer.asPath(); String[] nodes = pointerPath.split("/"); /* * The format of the pointer is like "/child/child[x]/.../child[y]". After the split the first two "nodes" are: * "" and "child". If a third is missing we are at the root. */ if (nodes.length < 3) { return ""; } StringBuilder pathBuilder = new StringBuilder(); // Since we have handled the case with the root for (int index = 2; index < nodes.length; index++) { // the format is 'node[someNumber]' so we drop 'node[' and ']' String nodeIndex = nodes[index].substring(5, nodes[index].length() - 1); Integer indexValue = Integer.valueOf(nodeIndex) - 1; pathBuilder.append(indexValue).append(AccessibilityElement.PATH_SEPARATOR); } return pathBuilder.toString(); } }
public String toString() { Pointer ptr = getContextNodePointer(); return ptr == null ? "Empty expression context" : "Expression context [" + getPosition() + "] " + ptr.asPath(); }
result.put(this.toPropertyName(p.asPath()), p.getValue());
repeaterContext.getRelativeContext(newRowContextPointer); if (getLogger().isDebugEnabled()) { getLogger().debug("inserted row at " + newRowContextPointer.asPath());
/** return the xpath for a particular object. * * @param target object to return xpath for. must be in object tree (or a similar object equivalent under equals()) * @return xpath for that object, or null * */ public final String getXPathFor(Object target) { // add variable we're looking for. JXPathContext cxt = this.accessJXPathContext(); cxt.getVariables().declareVariable("target",target); Pointer p = cxt.getPointer("//*[fn:matchTarget()]"); // tidyup cxt.getVariables().undeclareVariable("target"); // sanity check.. return p != null && p.getNode() != null ? p.asPath() : null; }
jxpc.removePath(item.getContext().createPath(".").asPath());