Package com.ctc.wstx.dtd
Class DTDValidator
java.lang.Object
org.codehaus.stax2.validation.XMLValidator
com.ctc.wstx.dtd.DTDValidatorBase
com.ctc.wstx.dtd.DTDValidator
- All Implemented Interfaces:
NsDefaultProvider
Woodstox implementation of
XMLValidator
; the class that
handles DTD-based validation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected BitSet
Bitset used for keeping track of required and defaulted attributes for which values have been found.protected ElementIdMap
Information about declared and referenced element ids (unique ids that attributes may defined, as defined by DTD)protected boolean
Determines if identical problems (definition of the same element, for example) should cause multiple error notifications or not: if true, will get one error per instance, if false, only the first one will get reported.protected BitSet
Reusable lazily instantiated BitSet; needed to keep track of missing 'special' attributes (required ones, ones with default values)protected StructValidator[]
Stack of validators for open elementsFields inherited from class com.ctc.wstx.dtd.DTDValidatorBase
DEFAULT_STACK_SIZE, EMPTY_MAP, EXP_MAX_ATTRS, mAttrCount, mAttrSpecs, mContext, mCurrAttrDefs, mCurrElem, mElemCount, mElems, mElemSpecs, mGeneralEntities, mHasNsDefaults, mIdAttrIndex, mNormAttrs, mSchema, mTmpAttrValueBuffer, mTmpKey, NO_ATTRS
Fields inherited from class org.codehaus.stax2.validation.XMLValidator
CONTENT_ALLOW_ANY_TEXT, CONTENT_ALLOW_NONE, CONTENT_ALLOW_UNDEFINED, CONTENT_ALLOW_VALIDATABLE_TEXT, CONTENT_ALLOW_WS, CONTENT_ALLOW_WS_NONSTRICT
-
Constructor Summary
ConstructorsConstructorDescriptionDTDValidator
(DTDSubset schema, org.codehaus.stax2.validation.ValidationContext ctxt, boolean hasNsDefaults, Map<PrefixedName, DTDElement> elemSpecs, Map<String, EntityDecl> genEntities) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected ElementIdMap
getIdMap()
final boolean
validateAttribute
(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) validateAttribute
(String localName, String uri, String prefix, String value) int
int
validateElementEnd
(String localName, String uri, String prefix) void
validateElementStart
(String localName, String uri, String prefix) Method called to update information about the newly encountered (start) element.void
validationCompleted
(boolean eod) Methods inherited from class com.ctc.wstx.dtd.DTDValidatorBase
checkNsDefaults, doAddDefaultValue, doReportValidationProblem, getAttributeType, getElemName, getEntityMap, getIdAttrIndex, getLocation, getNotationAttrIndex, getSchema, getTempAttrValueBuffer, hasNsDefaults, mayHaveNsDefaults, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, setAttrValueNormalization, validateText, validateText
Methods inherited from class org.codehaus.stax2.validation.XMLValidator
getSchemaType
-
Field Details
-
mReportDuplicateErrors
protected boolean mReportDuplicateErrorsDetermines if identical problems (definition of the same element, for example) should cause multiple error notifications or not: if true, will get one error per instance, if false, only the first one will get reported. -
mIdMap
Information about declared and referenced element ids (unique ids that attributes may defined, as defined by DTD) -
mValidators
Stack of validators for open elements -
mCurrSpecialAttrs
Bitset used for keeping track of required and defaulted attributes for which values have been found. -
mCurrHasAnyFixed
protected boolean mCurrHasAnyFixed -
mTmpSpecialAttrs
Reusable lazily instantiated BitSet; needed to keep track of missing 'special' attributes (required ones, ones with default values)
-
-
Constructor Details
-
DTDValidator
public DTDValidator(DTDSubset schema, org.codehaus.stax2.validation.ValidationContext ctxt, boolean hasNsDefaults, Map<PrefixedName, DTDElement> elemSpecs, Map<String, EntityDecl> genEntities)
-
-
Method Details
-
reallyValidating
public final boolean reallyValidating()- Specified by:
reallyValidating
in classDTDValidatorBase
- Returns:
- True for validator object that actually do validate content; false for objects that only use DTD type information.
-
validateElementStart
public void validateElementStart(String localName, String uri, String prefix) throws XMLStreamException Method called to update information about the newly encountered (start) element. At this point namespace information has been resolved, but no DTD validation has been done. Validator is to do these validations, including checking for attribute value (and existence) compatibility.- Specified by:
validateElementStart
in classDTDValidatorBase
- Throws:
XMLStreamException
-
validateAttribute
public String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException - Specified by:
validateAttribute
in classDTDValidatorBase
- Throws:
XMLStreamException
-
validateAttribute
public String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException - Specified by:
validateAttribute
in classDTDValidatorBase
- Throws:
XMLStreamException
-
validateElementAndAttributes
- Specified by:
validateElementAndAttributes
in classDTDValidatorBase
- Throws:
XMLStreamException
-
validateElementEnd
public int validateElementEnd(String localName, String uri, String prefix) throws XMLStreamException - Specified by:
validateElementEnd
in classDTDValidatorBase
- Returns:
- Validation state that should be effective for the parent element state
- Throws:
XMLStreamException
-
validationCompleted
- Specified by:
validationCompleted
in classDTDValidatorBase
- Throws:
XMLStreamException
-
getIdMap
- Specified by:
getIdMap
in classDTDValidatorBase
-
checkIdRefs
- Throws:
XMLStreamException
-