public class DTDValidator extends DTDValidatorBase
XMLValidator; the class that
handles DTD-based validation.| Modifier and Type | Field and Description |
|---|---|
protected BitSet |
mCurrSpecialAttrs
Bitset used for keeping track of required and defaulted attributes
for which values have been found.
|
protected ElementIdMap |
mIdMap
Information about declared and referenced element ids (unique
ids that attributes may defined, as defined by DTD)
|
protected boolean |
mReportDuplicateErrors
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 StructValidator[] |
mValidators
Stack of validators for open elements
|
EMPTY_MAP, mAttrCount, mAttrSpecs, mCurrAttrDefs, mCurrElem, mElemCount, mElems, mIdAttrIndex, mNormAttrs, mTmpKeyCONTENT_ALLOW_ANY_TEXT, CONTENT_ALLOW_NONE, CONTENT_ALLOW_UNDEFINED, CONTENT_ALLOW_VALIDATABLE_TEXT, CONTENT_ALLOW_WS, CONTENT_ALLOW_WS_NONSTRICT| Constructor and Description |
|---|
DTDValidator(DTDSubset schema,
ValidationContext ctxt,
boolean hasNsDefaults,
Map elemSpecs,
Map genEntities) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIdRefs() |
protected ElementIdMap |
getIdMap() |
boolean |
reallyValidating() |
String |
validateAttribute(String localName,
String uri,
String prefix,
char[] valueChars,
int valueStart,
int valueEnd)
Callback method called on validator to give it a chance to validate
the value of an attribute, as well as to normalize its value if
appropriate (remove leading/trailing/intervening white space for
certain token types etc.).
|
String |
validateAttribute(String localName,
String uri,
String prefix,
String value)
Callback method called on validator to give it a chance to validate
the value of an attribute, as well as to normalize its value if
appropriate (remove leading/trailing/intervening white space for
certain token types etc.).
|
int |
validateElementAndAttributes()
Method called after calling
XMLValidator.validateAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String) on all
attributes (if any), but before starting to handle element
content. |
int |
validateElementEnd(String localName,
String uri,
String prefix)
Method called right after encountering an element close tag.
|
void |
validateElementStart(String localName,
String uri,
String prefix)
Method called to update information about the newly encountered (start)
element.
|
void |
validationCompleted(boolean eod)
Method called when the validation is completed; either due to the
input stream ending, or due to an explicit 'stop validation' request
by the application (via context object).
|
checkNsDefaults, doAddDefaultValue, doReportValidationProblem, getAttributeType, getIdAttrIndex, getNotationAttrIndex, getSchema, hasNsDefaults, mayHaveNsDefaults, setAttrValueNormalization, validateText, validateTextgetSchemaTypeprotected boolean mReportDuplicateErrors
protected ElementIdMap mIdMap
protected StructValidator[] mValidators
protected BitSet mCurrSpecialAttrs
public DTDValidator(DTDSubset schema, ValidationContext ctxt, boolean hasNsDefaults, Map elemSpecs, Map genEntities)
public final boolean reallyValidating()
reallyValidating in class DTDValidatorBasepublic void validateElementStart(String localName, String uri, String prefix) throws XMLStreamException
validateElementStart in class DTDValidatorBaseXMLStreamExceptionpublic String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException
XMLValidatorvalidateAttribute in class DTDValidatorBaseXMLStreamExceptionpublic String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException
XMLValidatorvalidateAttribute in class DTDValidatorBasevalueChars - Character array that contains value (possibly
along with some other text)valueStart - Index of the first character of the value in
in valueChars arrayvalueEnd - Index of the character AFTER the last character;
so that the length of the value String is
valueEnd - valueStartXMLStreamExceptionpublic int validateElementAndAttributes()
throws XMLStreamException
XMLValidatorXMLValidator.validateAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String) on all
attributes (if any), but before starting to handle element
content.validateElementAndAttributes in class DTDValidatorBaseCONTENT_ALLOW_ constants, to indicate
what kind of textual content is allowed at the scope returned
to after the element has closed.XMLStreamExceptionpublic int validateElementEnd(String localName, String uri, String prefix) throws XMLStreamException
XMLValidatorvalidateElementEnd in class DTDValidatorBaseXMLStreamExceptionpublic void validationCompleted(boolean eod)
throws XMLStreamException
XMLValidatorvalidationCompleted in class DTDValidatorBaseeod - Flag that indicates whether this method was called by the
context due to the end of the stream (true); or by an application
requesting end of validation (false).XMLStreamExceptionprotected ElementIdMap getIdMap()
getIdMap in class DTDValidatorBaseprotected void checkIdRefs()
throws XMLStreamException
XMLStreamException