|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.custommonkey.xmlunit.Validator
public class Validator
Validates XML against its internal or external DOCTYPE, or a completely different DOCTYPE. Usage:
new Validator(readerForXML);
new Validator(readerForXML, systemIdForValidation);
new Validator(readerForXML, systemIdForValidation, doctypeName);
Constructor Summary | |
---|---|
|
Validator(org.w3c.dom.Document document,
java.lang.String systemID,
java.lang.String doctype)
DOM-style constructor: allows Document validation post-manipulation of the DOM tree's contents. |
|
Validator(org.xml.sax.InputSource sourceForValidation)
Basic constructor. |
protected |
Validator(org.xml.sax.InputSource inputSource,
boolean usingDoctypeReader)
Deprecated. Use the protected three arg constructor instead. |
|
Validator(org.xml.sax.InputSource sourceForValidation,
java.lang.String systemID)
Extended constructor. |
protected |
Validator(org.xml.sax.InputSource inputSource,
java.lang.String systemId,
boolean usingDoctypeReader)
Baseline constructor: called by all others |
|
Validator(org.xml.sax.InputSource sourceForValidation,
java.lang.String systemID,
java.lang.String doctype)
Full constructor. |
|
Validator(java.io.Reader readerForValidation)
Basic constructor. |
|
Validator(java.io.Reader readerForValidation,
java.lang.String systemID)
Extended constructor. |
|
Validator(java.io.Reader readerForValidation,
java.lang.String systemID,
java.lang.String doctype)
Full constructor. |
|
Validator(java.lang.String stringForValidation)
Basic constructor. |
|
Validator(java.lang.String stringForValidation,
java.lang.String systemID)
Extended constructor. |
Method Summary | |
---|---|
void |
assertIsValid()
Assert that a document is valid. |
void |
error(org.xml.sax.SAXParseException exception)
ErrorHandler interface method. |
void |
fatalError(org.xml.sax.SAXParseException exception)
ErrorHandler interface method. |
boolean |
isValid()
Perform the validation of the source against DTD / Schema. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Entity Resolver method: allows us to override an existing systemID referenced in the markup DOCTYPE instruction. |
void |
setJAXP12SchemaSource(java.lang.Object schemaSource)
As per JAXP 1.2 changes, which introduced a standard way for parsers to support schema validation. |
java.lang.String |
toString()
|
void |
useXMLSchema(boolean use)
Turn on XML Schema validation. |
void |
warning(org.xml.sax.SAXParseException exception)
ErrorHandler interface method. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Validator(org.xml.sax.InputSource inputSource, boolean usingDoctypeReader) throws org.xml.sax.SAXException, ConfigurationException
org.xml.sax.SAXException
ConfigurationException
protected Validator(org.xml.sax.InputSource inputSource, java.lang.String systemId, boolean usingDoctypeReader) throws org.xml.sax.SAXException, ConfigurationException
inputSource
- systemId
- usingDoctypeReader
-
org.xml.sax.SAXException
ConfigurationException
- if validation could not be turned onpublic Validator(org.w3c.dom.Document document, java.lang.String systemID, java.lang.String doctype) throws org.xml.sax.SAXException, ConfigurationException
document
- systemID
- doctype
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(java.io.Reader readerForValidation) throws org.xml.sax.SAXException, ConfigurationException
readerForValidation
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(java.lang.String stringForValidation) throws org.xml.sax.SAXException, ConfigurationException
stringForValidation
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(org.xml.sax.InputSource sourceForValidation) throws org.xml.sax.SAXException, ConfigurationException
readerForValidation
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(java.io.Reader readerForValidation, java.lang.String systemID) throws org.xml.sax.SAXException, ConfigurationException
readerForValidation
- systemID
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(java.lang.String stringForValidation, java.lang.String systemID) throws org.xml.sax.SAXException, ConfigurationException
stringForValidation
- systemID
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(org.xml.sax.InputSource sourceForValidation, java.lang.String systemID) throws org.xml.sax.SAXException, ConfigurationException
sourceForValidation
- systemID
-
org.xml.sax.SAXException
- if unable to obtain new Sax parser via JAXP factory
ConfigurationException
- if validation could not be turned onpublic Validator(org.xml.sax.InputSource sourceForValidation, java.lang.String systemID, java.lang.String doctype) throws org.xml.sax.SAXException, ConfigurationException
sourceForValidation
- systemID
- doctype
-
org.xml.sax.SAXException
ConfigurationException
- if validation could not be turned onpublic Validator(java.io.Reader readerForValidation, java.lang.String systemID, java.lang.String doctype) throws org.xml.sax.SAXException, ConfigurationException
readerForValidation
- systemID
- doctype
-
org.xml.sax.SAXException
ConfigurationException
- if validation could not be turned onMethod Detail |
---|
public void useXMLSchema(boolean use) throws org.xml.sax.SAXException
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 http://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.
use
- indicate that XML Schema should be used to validate
documents.
org.xml.sax.SAXException
setJAXP12SchemaSource(Object)
public boolean isValid()
public void assertIsValid()
public java.lang.String toString()
toString
in class java.lang.Object
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
exception
-
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
exception
-
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
exception
-
org.xml.sax.SAXException
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
resolveEntity
in interface org.xml.sax.EntityResolver
resolveEntity
in class org.xml.sax.helpers.DefaultHandler
publicId
- systemId
-
public void setJAXP12SchemaSource(java.lang.Object schemaSource) throws org.xml.sax.SAXException
schemaSource
- This can be one of the following:
org.xml.sax.SAXException
- if this method of validating isn't supported.http://java.sun.com/webservices/jaxp/change-requests-11.html
|
XMLUnit is hosted by sourceforge.net |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |