JXDocument { public List<JXNode> selN(String xpath) throws XpathSyntaxErrorException{ try { return xpathEva.xpathParser(xpath,elements); }catch (Exception e){ String msg = "please check the xpath syntax"; if (e instanceof NoSuchAxisException||e instanceof NoSuchFunctionException){ msg = e.getMessage(); } throw new XpathSyntaxErrorException(msg); } } JXDocument(Document doc);  JXDocument(String html);  JXDocument(Elements els); List<Object> sel(String xpath); List<JXNode> selN(String xpath); Object selOne(String xpath); JXNode selNOne(String xpath);  }
@Test @DataProvider(value = { " " " " " " " }) public void testXpath(String xpath) throws XpathSyntaxErrorException { System.out.println("current xpath:" + xpath); List<JXNode> rs = doubanTest.selN(xpath); for (JXNode n : rs) { if (!n.isText()) { int index = n.getElement().siblingIndex(); System.out.println(index); } System.out.println(n.toString()); } }
@Test @DataProvider(value = { " }) public void testRecursionNode(String xpath) throws XpathSyntaxErrorException { System.out.println("current xpath:" + xpath); List<JXNode> jxNodeList = doubanTest.selN(xpath); System.out.println(jxNodeList.size()); }
@Test public void testAs() throws XpathSyntaxErrorException { List<JXNode> jxNodeList = custom.selN(" for (JXNode jxNode : jxNodeList) { System.out.println(jxNode.getTextVal()); } }