public final class XMLUnit
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Document |
buildControlDocument(org.xml.sax.InputSource fromSource)
Utility method to build a Document using the control DocumentBuilder
and the specified InputSource
|
static org.w3c.dom.Document |
buildControlDocument(java.lang.String fromXML)
Utility method to build a Document using the control DocumentBuilder
to parse the specified String.
|
static org.w3c.dom.Document |
buildDocument(javax.xml.parsers.DocumentBuilder withBuilder,
org.xml.sax.InputSource fromSource)
Utility method to build a Document using a specific DocumentBuilder
and a specific InputSource
|
static org.w3c.dom.Document |
buildDocument(javax.xml.parsers.DocumentBuilder withBuilder,
java.io.Reader fromReader)
Utility method to build a Document using a specific DocumentBuilder
and reading characters from a specific Reader.
|
static org.w3c.dom.Document |
buildTestDocument(org.xml.sax.InputSource fromSource)
Utility method to build a Document using the test DocumentBuilder
and the specified InputSource
|
static org.w3c.dom.Document |
buildTestDocument(java.lang.String fromXML)
Utility method to build a Document using the test DocumentBuilder
to parse the specified String.
|
static Diff |
compare(org.xml.sax.InputSource control,
org.xml.sax.InputSource test)
Deprecated.
use Diff constructor directly
|
static Diff |
compare(java.io.Reader control,
java.io.Reader test)
Deprecated.
use Diff constructor directly
|
static Diff |
compare(java.io.Reader control,
java.lang.String test)
Deprecated.
use Diff constructor directly
|
static Diff |
compare(java.lang.String control,
java.io.Reader test)
Deprecated.
use Diff constructor directly
|
static Diff |
compare(java.lang.String control,
java.lang.String test)
Deprecated.
use Diff constructor directly
|
static Diff |
compareXML(org.w3c.dom.Document control,
org.w3c.dom.Document test)
Compare two XML documents provided as strings
|
static Diff |
compareXML(java.io.Reader control,
java.io.Reader test)
Compare XML documents provided by two Reader classes
|
static Diff |
compareXML(java.io.Reader control,
java.lang.String test)
Compare XML documents provided by two Reader classes
|
static Diff |
compareXML(java.lang.String control,
java.io.Reader test)
Compare XML documents provided by two Reader classes
|
static Diff |
compareXML(java.lang.String control,
java.lang.String test)
Compare two XML documents provided as strings
|
static javax.xml.parsers.DocumentBuilderFactory |
getControlDocumentBuilderFactory()
Get the
DocumentBuilderFactory instance used to instantiate
parsers for the control XML in an XMLTestCase. |
static javax.xml.parsers.DocumentBuilder |
getControlParser()
Get the
DocumentBuilder instance used to parse the control
XML in an XMLTestCase. |
static boolean |
getIgnoreWhitespace()
Whether to ignore whitespace when comparing node values.
|
static javax.xml.parsers.SAXParserFactory |
getSAXParserFactory()
Get the SAX parser to use in tests.
|
static Transform |
getStripWhitespaceTransform(org.w3c.dom.Document forDocument)
Obtain the transformation that will strip whitespace from a DOM containing
empty Text nodes
|
static javax.xml.parsers.DocumentBuilderFactory |
getTestDocumentBuilderFactory()
Get the
DocumentBuilderFactory instance used to instantiate
parsers for the test XML in an XMLTestCase. |
static javax.xml.parsers.DocumentBuilder |
getTestParser()
Get the
DocumentBuilder instance used to parse the test XML
in an XMLTestCase. |
static javax.xml.transform.TransformerFactory |
getTransformerFactory()
Get the transformer to use for XSLT transformations (and by
implication serialization and XPaths).
|
static java.lang.String |
getVersion()
Place holder for current version info.
|
static void |
setControlDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
Override the
DocumentBuilderFactory used to instantiate
parsers for the control XML in an XMLTestCase. |
static void |
setControlParser(java.lang.String className)
Overide the DocumentBuilder to use to parse control documents.
|
static void |
setIgnoreWhitespace(boolean ignore)
Whether to ignore whitespace when comparing node values.
|
static void |
setSAXParserFactory(java.lang.String className)
Override the SAX parser to use in tests.
|
static void |
setTestDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
Override the
DocumentBuilderFactory used to instantiate
parsers for the test XML in an XMLTestCase. |
static void |
setTestParser(java.lang.String className)
Overide the DocumentBuilder to use to parser test documents.
|
static void |
setTransformerFactory(java.lang.String className)
Overide the transformer to use for XSLT transformations (and by
implication serialization and XPaths).
|
public static void setControlParser(java.lang.String className)
throws javax.xml.parsers.FactoryConfigurationError
javax.xml.parsers.FactoryConfigurationErrorpublic static javax.xml.parsers.DocumentBuilder getControlParser()
throws javax.xml.parsers.ParserConfigurationException
DocumentBuilder instance used to parse the control
XML in an XMLTestCase.javax.xml.parsers.ParserConfigurationExceptionpublic static javax.xml.parsers.DocumentBuilderFactory getControlDocumentBuilderFactory()
DocumentBuilderFactory instance used to instantiate
parsers for the control XML in an XMLTestCase.public static void setControlDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
DocumentBuilderFactory used to instantiate
parsers for the control XML in an XMLTestCase.public static void setTestParser(java.lang.String className)
throws javax.xml.parsers.FactoryConfigurationError
javax.xml.parsers.FactoryConfigurationErrorpublic static javax.xml.parsers.DocumentBuilder getTestParser()
throws javax.xml.parsers.ParserConfigurationException
DocumentBuilder instance used to parse the test XML
in an XMLTestCase.javax.xml.parsers.ParserConfigurationExceptionpublic static javax.xml.parsers.DocumentBuilderFactory getTestDocumentBuilderFactory()
DocumentBuilderFactory instance used to instantiate
parsers for the test XML in an XMLTestCase.public static void setTestDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
DocumentBuilderFactory used to instantiate
parsers for the test XML in an XMLTestCase.public static void setIgnoreWhitespace(boolean ignore)
setIgnoringElementContentWhitespace()
on the underlying control AND test document builder factories.public static boolean getIgnoreWhitespace()
public static Diff compare(java.io.Reader control, java.io.Reader test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compare(org.xml.sax.InputSource control, org.xml.sax.InputSource test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
InputSourcescontrol - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compare(java.lang.String control, java.io.Reader test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compare(java.io.Reader control, java.lang.String test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compare(java.lang.String control, java.lang.String test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static org.w3c.dom.Document buildControlDocument(java.lang.String fromXML)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
fromXML - org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static org.w3c.dom.Document buildControlDocument(org.xml.sax.InputSource fromSource)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException
fromSource - org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static org.w3c.dom.Document buildTestDocument(java.lang.String fromXML)
throws org.xml.sax.SAXException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
fromXML - org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static org.w3c.dom.Document buildTestDocument(org.xml.sax.InputSource fromSource)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException
fromSource - org.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static org.w3c.dom.Document buildDocument(javax.xml.parsers.DocumentBuilder withBuilder,
java.io.Reader fromReader)
throws org.xml.sax.SAXException,
java.io.IOException
withBuilder - fromReader - org.xml.sax.SAXExceptionjava.io.IOExceptionpublic static org.w3c.dom.Document buildDocument(javax.xml.parsers.DocumentBuilder withBuilder,
org.xml.sax.InputSource fromSource)
throws java.io.IOException,
org.xml.sax.SAXException
withBuilder - fromSource - org.xml.sax.SAXExceptionjava.io.IOExceptionpublic static void setTransformerFactory(java.lang.String className)
throws javax.xml.transform.TransformerFactoryConfigurationError
javax.xml.transform.TransformerFactoryConfigurationErrorpublic static javax.xml.transform.TransformerFactory getTransformerFactory()
throws javax.xml.transform.TransformerFactoryConfigurationError
javax.xml.transform.TransformerFactoryConfigurationError - if unable to construct
a new instance of the default transformer factoryjavax.xml.transform.TransformerFactoryConfigurationErrorpublic static void setSAXParserFactory(java.lang.String className)
Validator classclassName - public static javax.xml.parsers.SAXParserFactory getSAXParserFactory()
Validator
to perform DTD validationpublic static Transform getStripWhitespaceTransform(org.w3c.dom.Document forDocument) throws javax.xml.transform.TransformerConfigurationException
forDocument - Transform to do the whitespace strippingjavax.xml.transform.TransformerConfigurationExceptionpublic static java.lang.String getVersion()
public static Diff compareXML(java.io.Reader control, java.io.Reader test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compareXML(java.lang.String control, java.io.Reader test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compareXML(java.io.Reader control, java.lang.String test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compareXML(java.lang.String control, java.lang.String test) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
control - Control documenttest - Document to testorg.xml.sax.SAXExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionpublic static Diff compareXML(org.w3c.dom.Document control, org.w3c.dom.Document test)
control - Control documenttest - Document to test