public class XSDValidator extends XMLMultiHandler implements XSDConstantValues
_abstract, _all, _annotation, _any, _anyAttribute, _anySimpleType, _anyType, _appinfo, _attrFormDefault, _attribute, _attributeGroup, _attrTag, _base, _block, _blockDefault, _choice, _complexContent, _complexType, _content, _default, _derivedBy, _documentation, _element, _elementOnly, _elemFormDefault, _empty, _enumeration, _equivClass, _extension, _false, _field, _final, _finalDefault, _fixed, _form, _group, _id, _import, _include, _itemType, _key, _keyref, _lax, _list, _maxOccurs, _memberTypes, _minOccurs, _mixed, _nall, _name, _namespace, _nil, _nillable, _nnany, _nnlist, _nnlocal, _nnother, _nntargetNS, _noNSSchemaLocation, _notation, _null, _nullable, _optional, _pattern, _processContents, _prohibited, _publicid, _qualified, _redefine, _ref, _refer, _required, _restriction, _restrictions, _schemaLocation, _selector, _sequence, _simpleContent, _simpleType, _skip, _strict, _substitution, _substitutionGrp, _systemid, _targetNS, _textOnly, _this, _true, _type, _undef, _union, _unique, _unqualified, _use, _value, _version, _xmlns, ABSENT_NS, ACCEPTED, ALL, ANNOTATION, ANY, ANY_ATTRIBUTE, ANY_NODE, ATTRIBUTE, ATTRIBUTE_GROUP, AUTO_VALIDATION, BASE_RESOLVED, BASE_UNRESOLVED, BASE_URL, BUILD_FAIL, CHOICE, CIRCULAR_SUBST, CONFLICIT_FACET, constName, DATATYPE, DEEP_VALIDATION, derivationBlock, DONE, DUPLICATE_DEF, duplicateId, ELEMENT, ELEMENT_CHILD, ELEMENT_ONLY, elemNotNullable, EMPTY, ENTITY_RESOLVER, EQUIV_RESOLVED, EQUIV_UNRESOLVED, ERROR, EXTENTION, FACET_CHILD, FAKE_ATTR, FAKE_NODE, FIXED_SCHEMA, GROUP, IABSTRACT, IBLOCKEXT, IBLOCKRST, IBLOCKSUB, IDENTITY_ERROR, IDENTITY_KEY, IDENTITY_KEYREF, IDENTITY_UNIQUE, IFINALEXT, IFINALLIST, IFINALRST, IFINALUNION, IMPORT, INCLUDE, INCORRECT_ATTR, INCORRECT_ELEM, INFINITY, INTERNAL_ERROR, INVALID_DATE, INVALID_DATETIME, INVALID_DERIVATION, INVALID_FACET, INVALID_FACET_VALUE, INVALID_NOTATION, INVALID_REGEX, INVALID_SCHEMA_NS, INVALID_TIME, INVALID_TYPE_VALUE, invalidAttr, invalidAttrVal, invalidChars, invalidElem, invalidFixedChars, invalidNS, invalidPrefix, invalidProperty, invalidRef, invalidSubstitution, invalidTargetNS, LAX_VALIDATION, MISSING_NS, missingAttr, MIXED, NEW_STATE, NO_CHILD, noDefinition, NOT_DONE, NOTATION, notComplete, notSubstitutable, notSubTypeOf, NS_CONFLICT, NS_DIF_SPECIFIED, NS_NOT_ALLOWED, NS_NOT_EXPECTED, NS_NOT_SAME, NS_RESOLVER, REDEFINE, REF_RESOLVED, REF_UNRESOLVED, RESTRICTION, ROOT_ELEMENT, ROOT_NODE, ROOT_TYPE, SCHEMA_NS, SCHEMA_RESOLVER, SEQ, STRICT_VALIDATION, TEXT_ONLY, TOP_LEVEL, TYPE, TYPE_RESOLVED, TYPE_UNRESOLVED, UNDEF, unexpectedAttr, unexpectedElem, VALIDATION_MODE, VIOLATE_FACET, XSDRECNS, XSDRECTYPENS, XSIRECNS, XSITYPE_ABSENT
Constructor and Description |
---|
XSDValidator()
XSDValidator constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch, int start, int length)
Propagate notification of character data inside an element.
|
boolean |
elementNilled()
Check if current element's content is nilled
|
void |
endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
Receive notification of the end of an element.
|
java.lang.String |
getCurrentMode()
Get the current validation mode
|
XSDElement |
getElementDeclaration()
Get the current element declaration
|
XSDElement |
getParentDeclaration()
Get the parent element declaration
|
XSDNode |
getTypeDefinition()
Get the current XSD type
|
java.lang.Object |
getXMLProperty(java.lang.String name) |
void |
reset()
Reset the validator, prepare for next validation
|
void |
setDocumentLocator(Locator locator)
Propagates Locator object for document events.
|
void |
setError(XMLError he)
Sets an XMLError object as current err.
|
java.lang.Object |
setXMLProperty(java.lang.String name, java.lang.Object value)
Set a property.
|
void |
setXMLSchema(XMLSchema s)
Deprecated.
|
void |
startDocument()
Receive notification of the beginning of the document.
|
void |
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts)
Receive notification of the beginning of an element.
|
addContentHandler, endDocument, endPrefixMapping, getContentHandlers, getNumContentHandlers, ignorableWhitespace, processingInstruction, removeContentHandler, skippedEntity, startPrefixMapping
public XSDValidator() throws XSDException
XSDException
public void reset()
public void setError(XMLError he) throws SAXException
he
- XMLError objectSAXException
- A SAXException
could be thrown.public void setXMLSchema(XMLSchema s) throws SAXException
s
- XMLSchema objectSAXException
- A SAXException
could be thrown.public java.lang.Object setXMLProperty(java.lang.String name, java.lang.Object value)
name
- - name of the propertyvalue
- - value of the propertypublic java.lang.Object getXMLProperty(java.lang.String name)
public java.lang.String getCurrentMode()
_strict
, _lax
, _skip
, or _error
public XSDNode getTypeDefinition()
XSDComplexType
node or XSDSimpleType<code/> node
getElementDeclaration
public XSDElement getElementDeclaration()
Get the current element declaration
Returns:
XSDElement
node
public XSDElement getParentDeclaration()
XSDElement
nodepublic boolean elementNilled()
boolean
true if current element is nilled, false otherwisepublic void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class XMLMultiHandler
SAXException
- Any SAX exception, possibly wrapping another exception.DocumentHandler.startDocument()
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class XMLMultiHandler
uri
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName
- The local name(without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified name (with prefix), or the empty string if qualified names are not available.atts
- The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.SAXException
- Any SAX exception, possibly wrapping another exception.endElement(java.lang.String, java.lang.String, java.lang.String)
, Attributes
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class XMLMultiHandler
uri
- The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName
- The local name (without prefix), or the empty string if Namespace processing is not being performed.qName
- The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.SAXException
- Any SAX exception, possibly wrapping another exception.public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class XMLMultiHandler
ch
- The characters.start
- The start position in the character array.length
- The number of characters to use from the character array.SAXException
- Any SAX exception, possibly wrapping another exception.DocumentHandler.characters(char[], int, int)
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class XMLMultiHandler
locator
- A locator for all SAX document events.DocumentHandler.setDocumentLocator(org.xml.sax.Locator)
, Locator