More or less Infoset based
Supported out of the box in Java 1.4 and later
But very painful: JDOM, XOM, etc. are much easier to use
Basic approach (irrespective of API):
Parse document (possibly in a fixture)
Navigate to the piece you want to test
Use Java (or Python, or C#, or whatever) to make the test