Saxparserfactory setvalidating true
This allows us to serialize java objects from a document.
There are methods for start/end of a document, element and so on. Content Handler and there's an empty helper class Default Handler.
The test below illustrates how the use of these classes: One of the key points about using XPaths with HTML content is that extracting values in tests requires the values to be identifiable.
(This is just another way of saying that testing HTML is easier when it is written to be testable.) In the previous example id attributes were used to identify the list item values that needed to be testable, however class attributes or span and div tags can also be used to identify specific content for testing.
The following test illustrates the use of a custom implementation as two pieces of XML are compared.
Using recursion it navigates through the nodes in the control XML DOM, and determines which node in the test XML DOM qualifies for comparison to the current control node.