I am using Xerces in Java. I would like to parse an HTML document to find a div element having a specific attribute (e.g., id = myID). Upon finding said element, I would like to return the text content within the div. I have been unable to find any examples of this online for Xerces.
Example:
<div id="myId">foo</div>
This should return foo.
Sorry this doesn’t answer using Xerces-J, but there is a library called jsoup that is made for this sort of thing (though I’m sure Xerces can do this as well). It’s sort of like Javascript for Java. Jsoup allows you to do something like this:
What do you think?