I'm trying to count how many certain elements the document has:
Iterator<?> processDescendants = doc.getDescendants(new ElementFilter("a"));
while(processDescendants.hasNext()) {
numPending++;
}
processDescendants = doc.getDescendants(new ElementFilter("b"));
while(processDescendants.hasNext()) {
numPending++;
}
There has to be an easier way... such as:
processDescendants = doc.getDescendants(new ElementFilter("a|b")); // something like Regex maybe?
Anyone can help? Thank you.