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 booleanprotected BitSetBitset used for keeping track of required and defaulted attributes for which values have been found.protected ElementIdMapInformation about declared and referenced element ids (unique ids that attributes may defined, as defined by DTD)protected booleanDetermines 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 BitSetReusable 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 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_ATTRSFields 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 voidprotected ElementIdMapgetIdMap()final booleanvalidateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) validateAttribute(String localName, String uri, String prefix, String value) intintvalidateElementEnd(String localName, String uri, String prefix) voidvalidateElementStart(String localName, String uri, String prefix) Method called to update information about the newly encountered (start) element.voidvalidationCompleted(boolean eod) Methods inherited from class DTDValidatorBase
checkNsDefaults, doAddDefaultValue, doReportValidationProblem, getAttributeType, getElemName, getEntityMap, getIdAttrIndex, getLocation, getNotationAttrIndex, getSchema, getTempAttrValueBuffer, hasNsDefaults, mayHaveNsDefaults, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, setAttrValueNormalization, validateText, validateTextMethods 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:
reallyValidatingin 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:
validateElementStartin classDTDValidatorBase- Throws:
XMLStreamException
-
validateAttribute
public String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException - Specified by:
validateAttributein classDTDValidatorBase- Throws:
XMLStreamException
-
validateAttribute
public String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException - Specified by:
validateAttributein classDTDValidatorBase- Throws:
XMLStreamException
-
validateElementAndAttributes
- Specified by:
validateElementAndAttributesin classDTDValidatorBase- Throws:
XMLStreamException
-
validateElementEnd
public int validateElementEnd(String localName, String uri, String prefix) throws XMLStreamException - Specified by:
validateElementEndin classDTDValidatorBase- Returns:
- Validation state that should be effective for the parent element state
- Throws:
XMLStreamException
-
validationCompleted
- Specified by:
validationCompletedin classDTDValidatorBase- Throws:
XMLStreamException
-
getIdMap
- Specified by:
getIdMapin classDTDValidatorBase
-
checkIdRefs
- Throws:
XMLStreamException
-