For a Jericho Element, I am trying to find out how to loop over all child nodes, whether an element or plain text.
Now there is Element.getNodeIterator(), but this references ALL descendants within the Element, not just the first descendants.
I need the equivalent of Element.getChildSegments(). Any ideas?
Thanks
Best Answer
All plain text segments not within any child elements, correct?
An element should have few direct children and the Element::contains(Segment) method is just a simple bounds check, so the performance should be adequate.
edit: If you wanted to add the ability to iterate all direct child segments it would look like this: