XML Matcher is a small Java library for matching XML documents with
templates. It was designed for automated testing of XML APIs (e.g. Web
Take a look at the following three examples:
|Template defines tolerance for
matching floating point values with actual document.
Namespace prefix 'xm' annotates internal elements and attributes of
|This template uses regular
expressions notation adapted for XML. It will match with actual
document where person is defined either by nickname (C.A.R) or using
first and last name (Tony Hoare).
More about regular expressions in XML Matcher here.
processing instructions to assert that values of the first and last
step elements are the same.
Complete set of constructs available in XML template is described in Reference Guide.
- XML patterns on both DOM structure and text value level.
- Regular Expressions on element and text value level (DOM Regex
scanner uses Glushkov NFA algorithm).
- Thread-Safe. Multiple instances of Matcher can run in parallel
- Customizable. It is very easy to add new matching
- Comparison is defined in terms of element tag names, attribute
name and values, and element
text values. Custom Matcher can be plugged to workaround this
- Mixed content in elements is not supported (an element may have
either CDATA text content or children elements, not both).