Java Doc for XMLUnit.java in  » Testing » XMLUnit » org » custommonkey » xmlunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » XMLUnit » org.custommonkey.xmlunit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.custommonkey.xmlunit.XMLUnit

XMLUnit
final public class XMLUnit (Code)
Allows access to project control parameters such as which Parser to use and provides some convenience methods for building Documents from Strings etc.
Examples and more at xmlunit.sourceforge.net




Method Summary
public static  DocumentbuildControlDocument(String fromXML)
     Utility method to build a Document using the control DocumentBuilder to parse the specified String.
public static  DocumentbuildControlDocument(InputSource fromSource)
    
public static  DocumentbuildDocument(DocumentBuilder withBuilder, Reader fromReader)
     Utility method to build a Document using a specific DocumentBuilder and reading characters from a specific Reader.
public static  DocumentbuildDocument(DocumentBuilder withBuilder, InputSource fromSource)
    
public static  DocumentbuildTestDocument(String fromXML)
     Utility method to build a Document using the test DocumentBuilder to parse the specified String.
public static  DocumentbuildTestDocument(InputSource fromSource)
    
public static  DiffcompareXML(InputSource control, InputSource test)
    
public static  DiffcompareXML(Reader control, Reader test)
    
public static  DiffcompareXML(String control, Reader test)
    
public static  DiffcompareXML(Reader control, String test)
    
public static  DiffcompareXML(String control, String test)
    
public static  DiffcompareXML(Document control, Document test)
    
public static  DocumentBuilderFactorygetControlDocumentBuilderFactory()
     Get the DocumentBuilderFactory instance used to instantiate parsers for the control XML in an XMLTestCase.
public static  EntityResolvergetControlEntityResolver()
     Obtains the EntityResolver to be added to all new control parsers.
public static  DocumentBuildergetControlParser()
     Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase.
public static  booleangetIgnoreAttributeOrder()
     Whether to ignore the order of attributes on an element.

The order of attributes has never been relevant for XML documents, still XMLUnit will consider two pieces of XML not-identical (but similar) if they differ in order of attributes.

public static  booleangetIgnoreComments()
     Whether comments should be ignored.
public static  booleangetIgnoreDiffBetweenTextAndCDATA()
     Whether CDATA sections and Text nodes should be considered the same.
public static  booleangetIgnoreWhitespace()
     Whether to ignore whitespace when comparing node values.
public static  booleangetNormalize()
     Whether Text nodes should be normalized.
public static  booleangetNormalizeWhitespace()
     Whether whitespace characters inside text nodes or attributes should be "normalized".
public static  SAXParserFactorygetSAXParserFactory()
     Get the SAX parser to use in tests.
public static  TransformgetStripCommentsTransform(Document forDocument)
     Obtain the transformation that will strip comments from a DOM.
public static  TransformgetStripWhitespaceTransform(Document forDocument)
    
public static  DocumentBuilderFactorygetTestDocumentBuilderFactory()
     Get the DocumentBuilderFactory instance used to instantiate parsers for the test XML in an XMLTestCase.
public static  DocumentBuildergetTestParser()
     Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase.
public static  TransformerFactorygetTransformerFactory()
     Get the transformer to use for XSLT transformations (and by implication serialization and XPaths).
public static  URIResolvergetURIResolver()
     Gets the URIResolver used during Transformations.
public static  StringgetVersion()
     Place holder for current version info.
public static  StringgetXPathFactory()
     Gets the class to use as XPathFactory when using JAXP 1.3.
static  StringgetXSLTStart()
     XSLT stylesheet element using the configured XSLT version.
public static  StringgetXSLTVersion()
     The XSLT version set on stylesheets used internally.
public static  NamespaceContextgetXpathNamespaceContext()
     Get the NamespaceContext to use in XPath tests.
public static  DocumentBuildernewControlParser()
     Get the DocumentBuilder instance used to parse the control XML in an XMLTestCase.
public static  DocumentBuildernewTestParser()
     Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase.
public static  XpathEnginenewXpathEngine()
     Obtains an XpathEngine to use in XPath tests.
public static  voidsetControlDocumentBuilderFactory(DocumentBuilderFactory factory)
     Override the DocumentBuilderFactory used to instantiate parsers for the control XML in an XMLTestCase.
public static  voidsetControlEntityResolver(EntityResolver resolver)
     Sets an EntityResolver to be added to all new control parsers.
public static  voidsetControlParser(String className)
     Overide the DocumentBuilder to use to parse control documents. This is useful when comparing the output of two different parsers.
public static  voidsetIgnoreAttributeOrder(boolean b)
     Whether to ignore the order of attributes on an element.

The order of attributes has never been relevant for XML documents, still XMLUnit will consider two pieces of XML not-identical (but similar) if they differ in order of attributes.

public static  voidsetIgnoreComments(boolean b)
     Whether comments should be ignored.
public static  voidsetIgnoreDiffBetweenTextAndCDATA(boolean b)
     Whether CDATA sections and Text nodes should be considered the same.
public static  voidsetIgnoreWhitespace(boolean ignore)
     Whether to ignore whitespace when comparing node values.
public static  voidsetNormalize(boolean b)
     Whether Text nodes should be normalized.

The default value is false

Note: if you are only working with documents read from streams (like files or network connections) or working with strings, there is no reason to change the default since the XML parser is required to normalize the documents.

public static  voidsetNormalizeWhitespace(boolean b)
     Whether whitespace characters inside text nodes or attributes should be "normalized".
public static  voidsetSAXParserFactory(String className)
     Override the SAX parser to use in tests.
public static  voidsetTestDocumentBuilderFactory(DocumentBuilderFactory factory)
     Override the DocumentBuilderFactory used to instantiate parsers for the test XML in an XMLTestCase.
public static  voidsetTestEntityResolver(EntityResolver resolver)
     Sets an EntityResolver to be added to all new test parsers.
public static  voidsetTestParser(String className)
     Overide the DocumentBuilder to use to parser test documents. This is useful when comparing the output of two different parsers.
public static  voidsetTransformerFactory(String className)
     Overide the transformer to use for XSLT transformations (and by implication serialization and XPaths).
public static  voidsetURIResolver(URIResolver resolver)
     Sets the URIResolver to use during transformations.
public static  voidsetXPathFactory(String className)
     Sets the class to use as XPathFactory when using JAXP 1.3.
public static  voidsetXSLTVersion(String s)
     Sets the XSLT version to set on stylesheets used internally.
public static  voidsetXpathNamespaceContext(NamespaceContext ctx)
     Set the NamespaceContext to use in XPath tests.



Method Detail
buildControlDocument
public static Document buildControlDocument(String fromXML) throws SAXException, IOException(Code)
Utility method to build a Document using the control DocumentBuilder to parse the specified String.
Parameters:
  fromXML - Document representation of the String content
throws:
  SAXException -
throws:
  IOException -



buildControlDocument
public static Document buildControlDocument(InputSource fromSource) throws IOException, SAXException(Code)
Utility method to build a Document using the control DocumentBuilder and the specified InputSource
Parameters:
  fromSource - Document representation of the String content
throws:
  SAXException -
throws:
  IOException -



buildDocument
public static Document buildDocument(DocumentBuilder withBuilder, Reader fromReader) throws SAXException, IOException(Code)
Utility method to build a Document using a specific DocumentBuilder and reading characters from a specific Reader.
Parameters:
  withBuilder -
Parameters:
  fromReader - Document built
throws:
  SAXException -
throws:
  IOException -



buildDocument
public static Document buildDocument(DocumentBuilder withBuilder, InputSource fromSource) throws IOException, SAXException(Code)
Utility method to build a Document using a specific DocumentBuilder and a specific InputSource
Parameters:
  withBuilder -
Parameters:
  fromSource - Document built
throws:
  SAXException -
throws:
  IOException -



buildTestDocument
public static Document buildTestDocument(String fromXML) throws SAXException, IOException(Code)
Utility method to build a Document using the test DocumentBuilder to parse the specified String.
Parameters:
  fromXML - Document representation of the String content
throws:
  SAXException -
throws:
  IOException -



buildTestDocument
public static Document buildTestDocument(InputSource fromSource) throws IOException, SAXException(Code)
Utility method to build a Document using the test DocumentBuilder and the specified InputSource
Parameters:
  fromSource - Document representation of the String content
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(InputSource control, InputSource test) throws SAXException, IOException(Code)
Compare XML documents provided by two InputSource classes
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(Reader control, Reader test) throws SAXException, IOException(Code)
Compare XML documents provided by two Reader classes
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(String control, Reader test) throws SAXException, IOException(Code)
Compare XML documents provided by two Reader classes
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(Reader control, String test) throws SAXException, IOException(Code)
Compare XML documents provided by two Reader classes
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(String control, String test) throws SAXException, IOException(Code)
Compare two XML documents provided as strings
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents
throws:
  SAXException -
throws:
  IOException -



compareXML
public static Diff compareXML(Document control, Document test)(Code)
Compare two XML documents provided as strings
Parameters:
  control - Control document
Parameters:
  test - Document to test Diff object describing differences in documents



getControlDocumentBuilderFactory
public static DocumentBuilderFactory getControlDocumentBuilderFactory()(Code)
Get the DocumentBuilderFactory instance used to instantiate parsers for the control XML in an XMLTestCase. factory for control parsers



getControlEntityResolver
public static EntityResolver getControlEntityResolver()(Code)
Obtains the EntityResolver to be added to all new control parsers.



getControlParser
public static DocumentBuilder getControlParser() throws ConfigurationException(Code)
Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase. parser for control values
throws:
  ConfigurationException -



getIgnoreAttributeOrder
public static boolean getIgnoreAttributeOrder()(Code)
Whether to ignore the order of attributes on an element.

The order of attributes has never been relevant for XML documents, still XMLUnit will consider two pieces of XML not-identical (but similar) if they differ in order of attributes. Set this option to false to ignore the order.

The default value is false for backwards compatibility reasons.




getIgnoreComments
public static boolean getIgnoreComments()(Code)
Whether comments should be ignored.

The default value is false




getIgnoreDiffBetweenTextAndCDATA
public static boolean getIgnoreDiffBetweenTextAndCDATA()(Code)
Whether CDATA sections and Text nodes should be considered the same.

The default is false.




getIgnoreWhitespace
public static boolean getIgnoreWhitespace()(Code)
Whether to ignore whitespace when comparing node values. true if whitespace should be ignored when comparing nodes, falseotherwise



getNormalize
public static boolean getNormalize()(Code)
Whether Text nodes should be normalized.

The default value is false




getNormalizeWhitespace
public static boolean getNormalizeWhitespace()(Code)
Whether whitespace characters inside text nodes or attributes should be "normalized".

Normalized in this context means that all whitespace is replaced by the space character and adjacent whitespace characters are collapsed to a single space character.

The default value is false.




getSAXParserFactory
public static SAXParserFactory getSAXParserFactory()(Code)
Get the SAX parser to use in tests. the SAXParserFactory instance used by the Validator Validatorto perform DTD validation



getStripCommentsTransform
public static Transform getStripCommentsTransform(Document forDocument)(Code)
Obtain the transformation that will strip comments from a DOM.
Parameters:
  forDocument - a Transform to do the whitespace stripping



getStripWhitespaceTransform
public static Transform getStripWhitespaceTransform(Document forDocument)(Code)
Obtain the transformation that will strip whitespace from a DOM containing empty Text nodes
Parameters:
  forDocument - a Transform to do the whitespace stripping



getTestDocumentBuilderFactory
public static DocumentBuilderFactory getTestDocumentBuilderFactory()(Code)
Get the DocumentBuilderFactory instance used to instantiate parsers for the test XML in an XMLTestCase. factory for test parsers



getTestParser
public static DocumentBuilder getTestParser() throws ConfigurationException(Code)
Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase. parser for test values
throws:
  ConfigurationException -



getTransformerFactory
public static TransformerFactory getTransformerFactory()(Code)
Get the transformer to use for XSLT transformations (and by implication serialization and XPaths). the current transformer factory in usea new instance of the default transformer factory



getURIResolver
public static URIResolver getURIResolver()(Code)
Gets the URIResolver used during Transformations.



getVersion
public static String getVersion()(Code)
Place holder for current version info. current version



getXPathFactory
public static String getXPathFactory()(Code)
Gets the class to use as XPathFactory when using JAXP 1.3.



getXSLTStart
static String getXSLTStart()(Code)
XSLT stylesheet element using the configured XSLT version.



getXSLTVersion
public static String getXSLTVersion()(Code)
The XSLT version set on stylesheets used internally.

Defaults to "1.0".




getXpathNamespaceContext
public static NamespaceContext getXpathNamespaceContext()(Code)
Get the NamespaceContext to use in XPath tests.



newControlParser
public static DocumentBuilder newControlParser() throws ConfigurationException(Code)
Get the DocumentBuilder instance used to parse the control XML in an XMLTestCase. parser for control values
throws:
  ConfigurationException -



newTestParser
public static DocumentBuilder newTestParser() throws ConfigurationException(Code)
Get the DocumentBuilder instance used to parse the test XML in an XMLTestCase. parser for test values
throws:
  ConfigurationException -



newXpathEngine
public static XpathEngine newXpathEngine()(Code)
Obtains an XpathEngine to use in XPath tests.



setControlDocumentBuilderFactory
public static void setControlDocumentBuilderFactory(DocumentBuilderFactory factory)(Code)
Override the DocumentBuilderFactory used to instantiate parsers for the control XML in an XMLTestCase.



setControlEntityResolver
public static void setControlEntityResolver(EntityResolver resolver)(Code)
Sets an EntityResolver to be added to all new control parsers. Setting to null will reset to the default EntityResolver



setControlParser
public static void setControlParser(String className)(Code)
Overide the DocumentBuilder to use to parse control documents. This is useful when comparing the output of two different parsers. Note: setting the control parser before any test cases are run will affect the test parser as well.



setIgnoreAttributeOrder
public static void setIgnoreAttributeOrder(boolean b)(Code)
Whether to ignore the order of attributes on an element.

The order of attributes has never been relevant for XML documents, still XMLUnit will consider two pieces of XML not-identical (but similar) if they differ in order of attributes. Set this option to false to ignore the order.

The default value is false for backwards compatibility reasons.




setIgnoreComments
public static void setIgnoreComments(boolean b)(Code)
Whether comments should be ignored.

The default value is false




setIgnoreDiffBetweenTextAndCDATA
public static void setIgnoreDiffBetweenTextAndCDATA(boolean b)(Code)
Whether CDATA sections and Text nodes should be considered the same.

The default is false.




setIgnoreWhitespace
public static void setIgnoreWhitespace(boolean ignore)(Code)
Whether to ignore whitespace when comparing node values.

This method also invokes setIgnoringElementContentWhitespace() on the underlying control AND test document builder factories.

Setting this parameter has no effect on setNormalizeWhitespace whitespace inside texts .




setNormalize
public static void setNormalize(boolean b)(Code)
Whether Text nodes should be normalized.

The default value is false

Note: if you are only working with documents read from streams (like files or network connections) or working with strings, there is no reason to change the default since the XML parser is required to normalize the documents. If you are testing org.w3c.Document Document instances you've created in code, you may want to alter the default behavior.

Note2: depending on the XML parser or XSLT transformer you use, setting setIgnoreWhitespaceignoreWhitespace or setIgnoreComments ignoreComments to true may have already normalized your document and this setting doesn't have any effect anymore.




setNormalizeWhitespace
public static void setNormalizeWhitespace(boolean b)(Code)
Whether whitespace characters inside text nodes or attributes should be "normalized".

Normalized in this context means that all whitespace is replaced by the space character and adjacent whitespace characters are collapsed to a single space character.

The default value is false.

Setting this parameter has no effect on setIgnoreWhitespace ignorable whitespace .




setSAXParserFactory
public static void setSAXParserFactory(String className)(Code)
Override the SAX parser to use in tests. Currently only used by Validator Validator class
Parameters:
  className -



setTestDocumentBuilderFactory
public static void setTestDocumentBuilderFactory(DocumentBuilderFactory factory)(Code)
Override the DocumentBuilderFactory used to instantiate parsers for the test XML in an XMLTestCase.



setTestEntityResolver
public static void setTestEntityResolver(EntityResolver resolver)(Code)
Sets an EntityResolver to be added to all new test parsers. Setting to null will reset to the default EntityResolver



setTestParser
public static void setTestParser(String className)(Code)
Overide the DocumentBuilder to use to parser test documents. This is useful when comparing the output of two different parsers. Note: setting the test parser before any test cases are run will affect the control parser as well.



setTransformerFactory
public static void setTransformerFactory(String className)(Code)
Overide the transformer to use for XSLT transformations (and by implication serialization and XPaths). This is useful when comparing transformer implementations.



setURIResolver
public static void setURIResolver(URIResolver resolver)(Code)
Sets the URIResolver to use during transformations.



setXPathFactory
public static void setXPathFactory(String className)(Code)
Sets the class to use as XPathFactory when using JAXP 1.3.



setXSLTVersion
public static void setXSLTVersion(String s)(Code)
Sets the XSLT version to set on stylesheets used internally.

Defaults to "1.0".


throws:
  ConfigurationException - if the argument cannot be parsedas a positive number.



setXpathNamespaceContext
public static void setXpathNamespaceContext(NamespaceContext ctx)(Code)
Set the NamespaceContext to use in XPath tests.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.