Class PathParsers


  • public final class PathParsers
    extends Object
    functions to find DOM elements in a W3C document. These functions are also useful to experiment and test with how Paths can be used to extract elements (they are used in many of the unit tests of DollarX).
    Example use:
     
         Path el = div.before(span);
         String xpath = el.getXPath().get();
         NodeList nodes = findAllByXpath("<div>foo</div><div>boo</div><span></span>", el);
         assertThat(nodes.getLength(), is(2));
         assertThat(nodes.item(0).getTextContent(), equalTo("foo"));