@Test
public void fixTextElNoParentTest(){
String test="<div class='a'> a <div>need</div> <div class='e'> not need</div> c </div>";
JXDocument j = JXDocument.create(test);
List<JXNode> l = j.selN("//div[@class='a']//text()[not(ancestor::div[@class='e'])]");
Set<String> finalRes = new HashSet<>();
for (JXNode i : l){
logger.info("{}",i.toString());
finalRes.add(i.asString());
}
Assert.assertFalse(finalRes.contains("not need"));
Assert.assertTrue(finalRes.contains("need"));
Assert.assertEquals(4, finalRes.size());
}