public class Validator extends DefaultHandler
new Validator(readerForXML); new Validator(readerForXML, systemIdForValidation); new Validator(readerForXML, systemIdForValidation, doctypeName); | Modifier | Constructor and Description |
|---|---|
|
Validator(Document document,
String systemID,
String doctype)
DOM-style constructor: allows Document validation post-manipulation
of the DOM tree's contents.
|
|
Validator(InputSource sourceForValidation)
Basic constructor.
|
|
Validator(InputSource sourceForValidation,
String systemID)
Extended constructor.
|
protected |
Validator(InputSource inputSource,
String systemId,
boolean usingDoctypeReader)
Baseline constructor: called by all others
|
|
Validator(InputSource sourceForValidation,
String systemID,
String doctype)
Full constructor.
|
|
Validator(Reader readerForValidation)
Basic constructor.
|
|
Validator(Reader readerForValidation,
String systemID)
Extended constructor.
|
|
Validator(Reader readerForValidation,
String systemID,
String doctype)
Full constructor.
|
|
Validator(String stringForValidation)
Basic constructor.
|
|
Validator(String stringForValidation,
String systemID)
Extended constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertIsValid()
Assert that a document is valid.
|
boolean |
isValid()
Perform the validation of the source against DTD / Schema.
|
void |
setJAXP12SchemaSource(Object schemaSource)
As per JAXP 1.2 changes, which introduced a standard way for parsers to
support schema validation.
|
String |
toString() |
void |
useXMLSchema(boolean use)
Turn on XML Schema validation.
|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warningprotected Validator(InputSource inputSource, String systemId, boolean usingDoctypeReader)
inputSource - systemId - usingDoctypeReader - public Validator(Document document, String systemID, String doctype)
document - systemID - doctype - public Validator(Reader readerForValidation)
readerForValidation - public Validator(String stringForValidation)
stringForValidation - public Validator(InputSource sourceForValidation)
sourceForValidation - public Validator(Reader readerForValidation, String systemID)
readerForValidation - systemID - public Validator(String stringForValidation, String systemID)
stringForValidation - systemID - public Validator(InputSource sourceForValidation, String systemID)
sourceForValidation - systemID - public Validator(InputSource sourceForValidation, String systemID, String doctype)
sourceForValidation - systemID - doctype - public void useXMLSchema(boolean use)
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.setJAXP12SchemaSource(Object)public boolean isValid()
public void assertIsValid()
public String toString()
public void setJAXP12SchemaSource(Object schemaSource)
schemaSource - This can be one of the following:
Copyright © 2001–2021 XMLUnit. All rights reserved.