@Test public void deeperStructure() { Element e = doc.createElement("foo"); doc.appendChild(e); Element e2 = doc.createElement("foo"); e.appendChild(e2); e2.appendChild(doc.createElement("foo")); Element e3 = doc.createElement("foo"); e2.appendChild(e3); e2.appendChild(doc.createComment("foo")); Comment c = doc.createComment("foo"); e2.appendChild(c); assertEquals("/foo[1]/foo[1]/foo[2]", builder.apply(e3).getXPath()); assertEquals("/foo[1]/foo[1]/comment()[2]", builder.apply(c).getXPath()); }
@Override public XPathContext apply(Node n) { if (n instanceof Attr) { return getXPathForAttribute((Attr) n); } else { return getXPathForNonAttribute(n); } }
RecursiveXPathBuilder implements Mapper<Node, XPathContext> { @Override public XPathContext apply(Node n) { if (n instanceof Attr) { return getXPathForAttribute((Attr) n); } else { return getXPathForNonAttribute(n); } } }
RecursiveXPathBuilder implements Mapper<Node, XPathContext> { @Override public XPathContext apply(Node n) { if (n instanceof Attr) { return getXPathForAttribute((Attr) n); } else { return getXPathForNonAttribute(n); } }  }
RecursiveXPathBuilder implements Mapper<Node, XPathContext> { @Override public XPathContext apply(Node n) { if (n instanceof Attr) { return getXPathForAttribute((Attr) n); } else { return getXPathForNonAttribute(n); } }  void setNamespaceContext(Map<String, String> prefix2uri); @Override XPathContext apply(Node n); }
RecursiveXPathBuilder implements Mapper<Node, XPathContext> { @Override public XPathContext apply(Node n) { if (n instanceof Attr) { return getXPathForAttribute((Attr) n); } else { return getXPathForNonAttribute(n); } }  void setNamespaceContext(Map<String, String> prefix2uri); @Override XPathContext apply(Node n);  }