Java Doc for Validator.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.xml.sax.helpers.DefaultHandler
      org.custommonkey.xmlunit.Validator

Validator
public class Validator extends DefaultHandler implements ErrorHandler(Code)
Validates XML against its internal or external DOCTYPE, or a completely different DOCTYPE. Usage:
  • new Validator(readerForXML);
    to validate some XML that contains or references an accessible DTD or schema
  • new Validator(readerForXML, systemIdForValidation);
    to validate some XML that references a DTD but using a local systemId to perform the validation
  • new Validator(readerForXML, systemIdForValidation, doctypeName);
    to validate some XML against a completely different DTD

Examples and more at xmlunit.sourceforge.net



Constructor Summary
protected  Validator(InputSource inputSource, boolean usingDoctypeReader)
     Kept for backwards compatibility.
protected  Validator(InputSource inputSource, String systemId, boolean usingDoctypeReader)
    
public  Validator(Document document, String systemID, String doctype)
     DOM-style constructor: allows Document validation post-manipulation of the DOM tree's contents.
public  Validator(Reader readerForValidation)
     Basic constructor.
public  Validator(String stringForValidation)
     Basic constructor.
public  Validator(InputSource sourceForValidation)
     Basic constructor.
public  Validator(Reader readerForValidation, String systemID)
     Extended constructor. Validates the contents of the Reader using the DTD specified with the systemID.
public  Validator(String stringForValidation, String systemID)
     Extended constructor. Validates the contents of the String using the DTD specified with the systemID.
public  Validator(InputSource sourceForValidation, String systemID)
     Extended constructor. Validates the contents of the InputSource using the DTD specified with the systemID.
public  Validator(InputSource sourceForValidation, String systemID, String doctype)
     Full constructor.
public  Validator(Reader readerForValidation, String systemID, String doctype)
     Full constructor.

Method Summary
public  voidassertIsValid()
     Assert that a document is valid.
public  voiderror(SAXParseException exception)
     ErrorHandler interface method.
public  voidfatalError(SAXParseException exception)
     ErrorHandler interface method.
public  booleanisValid()
     Perform the validation of the source against DTD / Schema.
public  InputSourceresolveEntity(String publicId, String systemId)
     Entity Resolver method: allows us to override an existing systemID referenced in the markup DOCTYPE instruction.
public  voidsetJAXP12SchemaSource(Object schemaSource)
     As per JAXP 1.2 changes, which introduced a standard way for parsers to support schema validation.
public  StringtoString()
    
public  voiduseXMLSchema(boolean use)
     Turn on XML Schema validation.
public  voidwarning(SAXParseException exception)
     ErrorHandler interface method.


Constructor Detail
Validator
protected Validator(InputSource inputSource, boolean usingDoctypeReader) throws SAXException, ConfigurationException(Code)
Kept for backwards compatibility.



Validator
protected Validator(InputSource inputSource, String systemId, boolean usingDoctypeReader) throws SAXException, ConfigurationException(Code)
Baseline constructor: called by all others
Parameters:
  inputSource -
Parameters:
  systemId -
Parameters:
  usingDoctypeReader -
throws:
  SAXException -
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(Document document, String systemID, String doctype) throws SAXException, ConfigurationException(Code)
DOM-style constructor: allows Document validation post-manipulation of the DOM tree's contents. This takes a fairly tortuous route to validation as DOM level 2 does not allow creation of Doctype nodes. The supplied systemId and doctype name will replace any Doctype settings in the Document.
Parameters:
  document -
Parameters:
  systemID -
Parameters:
  doctype -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(Reader readerForValidation) throws SAXException, ConfigurationException(Code)
Basic constructor. Validates the contents of the Reader using the DTD or schema referenced by those contents.
Parameters:
  readerForValidation -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(String stringForValidation) throws SAXException, ConfigurationException(Code)
Basic constructor. Validates the contents of the String using the DTD or schema referenced by those contents.
Parameters:
  stringForValidation -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(InputSource sourceForValidation) throws SAXException, ConfigurationException(Code)
Basic constructor. Validates the contents of the InputSource using the DTD or schema referenced by those contents.
Parameters:
  readerForValidation -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(Reader readerForValidation, String systemID) throws SAXException, ConfigurationException(Code)
Extended constructor. Validates the contents of the Reader using the DTD specified with the systemID. There must be DOCTYPE instruction in the markup that references the DTD or else the markup will be considered invalid: if there is no DOCTYPE in the markup use the 3-argument constructor
Parameters:
  readerForValidation -
Parameters:
  systemID -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(String stringForValidation, String systemID) throws SAXException, ConfigurationException(Code)
Extended constructor. Validates the contents of the String using the DTD specified with the systemID. There must be DOCTYPE instruction in the markup that references the DTD or else the markup will be considered invalid: if there is no DOCTYPE in the markup use the 3-argument constructor
Parameters:
  stringForValidation -
Parameters:
  systemID -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(InputSource sourceForValidation, String systemID) throws SAXException, ConfigurationException(Code)
Extended constructor. Validates the contents of the InputSource using the DTD specified with the systemID. There must be DOCTYPE instruction in the markup that references the DTD or else the markup will be considered invalid: if there is no DOCTYPE in the markup use the 3-argument constructor
Parameters:
  sourceForValidation -
Parameters:
  systemID -
throws:
  SAXException - if unable to obtain new Sax parser via JAXP factory
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(InputSource sourceForValidation, String systemID, String doctype) throws SAXException, ConfigurationException(Code)
Full constructor. Validates the contents of the InputSource using the DTD specified with the systemID and named with the doctype name.
Parameters:
  sourceForValidation -
Parameters:
  systemID -
Parameters:
  doctype -
throws:
  SAXException -
throws:
  ConfigurationException - if validation could not be turned on



Validator
public Validator(Reader readerForValidation, String systemID, String doctype) throws SAXException, ConfigurationException(Code)
Full constructor. Validates the contents of the Reader using the DTD specified with the systemID and named with the doctype name.
Parameters:
  readerForValidation -
Parameters:
  systemID -
Parameters:
  doctype -
throws:
  SAXException -
throws:
  ConfigurationException - if validation could not be turned on




Method Detail
assertIsValid
public void assertIsValid()(Code)
Assert that a document is valid.



error
public void error(SAXParseException exception) throws SAXException(Code)
ErrorHandler interface method.
Parameters:
  exception -
throws:
  SAXException -



fatalError
public void fatalError(SAXParseException exception) throws SAXException(Code)
ErrorHandler interface method.
Parameters:
  exception -
throws:
  SAXException -



isValid
public boolean isValid()(Code)
Perform the validation of the source against DTD / Schema. true if the input supplied to the constructor passes validation,false otherwise



resolveEntity
public InputSource resolveEntity(String publicId, String systemId)(Code)
Entity Resolver method: allows us to override an existing systemID referenced in the markup DOCTYPE instruction.
Parameters:
  publicId -
Parameters:
  systemId - the sax InputSource that points to the overridden systemID



setJAXP12SchemaSource
public void setJAXP12SchemaSource(Object schemaSource) throws SAXException(Code)
As per JAXP 1.2 changes, which introduced a standard way for parsers to support schema validation. Since only W3C Schema support was included in JAXP 1.2, this is the only mechanism currently supported by this method.
Parameters:
  schemaSource - This can be one of the following:
  • String that points to the URI of the schema
  • InputStream with the contents of the schema
  • SAX InputSource
  • File
  • an array of Objects with the contents being one of thetypes defined above. An array of Objects can be used only whenthe schema language has the ability to assemble a schema atruntime. When an array of Objects is passed it is illegal tohave two schemas that share the same namespace.

throws:
  SAXException - if this method of validating isn't supported.
See Also:    http://java.sun.com/webservices/jaxp/change-requests-11.html



toString
public String toString()(Code)
class name appended with validation messages



useXMLSchema
public void useXMLSchema(boolean use) throws SAXException(Code)
Turn on XML Schema validation.

This feature should work with any XML parser that is JAXP 1.2 compliant and supports XML Schema validation.

For a fully JAXP 1.2 compliant parser the property JAXPConstants.Properties.SCHEMA_LANGUAGEhttp://java.sun.com/xml/jaxp/properties/schemaLanguage is set, if this fails the method falls back to the features http://apache.org/xml/features/validation/schema & http://apache.org/xml/features/validation/dynamic which should cover early versions of Xerces 2 as well.


Parameters:
  use - indicate that XML Schema should be used to validatedocuments.
throws:
  SAXException -
See Also:   Validator.setJAXP12SchemaSource(Object)



warning
public void warning(SAXParseException exception) throws SAXException(Code)
ErrorHandler interface method.
Parameters:
  exception -
throws:
  SAXException -



Methods inherited from org.xml.sax.helpers.DefaultHandler
public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void endDocument() throws SAXException(Code)(Java Doc)
public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc)
public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc)
public void error(SAXParseException e) throws SAXException(Code)(Java Doc)
public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc)
public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc)
public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc)
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException(Code)(Java Doc)
public void setDocumentLocator(Locator locator)(Code)(Java Doc)
public void skippedEntity(String name) throws SAXException(Code)(Java Doc)
public void startDocument() throws SAXException(Code)(Java Doc)
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)(Java Doc)
public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc)
public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)

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.