public abstract class DTDValidatorBase extends org.codehaus.stax2.validation.XMLValidator implements NsDefaultProvider
XMLValidator for DTD validation.
Since there are 2 sub-types -- full actual DTD validator, and a dummy
one that only adds type information and default values, with no actual
validation -- common functionality was refactored into this base
class.| Modifier and Type | Field and Description |
|---|---|
protected static HashMap<String,EntityDecl> |
EMPTY_MAP
Let's actually just reuse a local Map...
|
protected int |
mAttrCount
Number of attribute specification Objects in
mAttrSpecs; needed to store in case type information
is requested later on. |
protected DTDAttribute[] |
mAttrSpecs
List of attribute declarations/specifications, one for each
attribute of the current element, for which there is a matching
value (either explicitly defined, or assigned via defaulting).
|
protected HashMap<PrefixedName,DTDAttribute> |
mCurrAttrDefs
Attribute definitions for attributes the current element may have
|
protected DTDElement |
mCurrElem
This is the element that is currently being validated; valid
during
validateElementStart,
validateAttribute,
validateElementAndAttributes calls. |
protected int |
mElemCount
Number of elements in
mElems. |
protected DTDElement[] |
mElems
Stack of element definitions matching the current active element stack.
|
protected int |
mIdAttrIndex
Index of the attribute of type ID, within current element's
attribute list.
|
protected boolean |
mNormAttrs
Flag that indicates whether parser wants the attribute values
to be normalized (according to XML specs) or not (which may be
more efficient, although not compliant with the specs)
|
protected PrefixedName |
mTmpKey |
protected static HashMap<PrefixedName,DTDAttribute> |
NO_ATTRS |
| Constructor and Description |
|---|
DTDValidatorBase(DTDSubset schema,
org.codehaus.stax2.validation.ValidationContext ctxt,
boolean hasNsDefaults,
Map<PrefixedName,DTDElement> elemSpecs,
Map<String,EntityDecl> genEntities) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkNsDefaults(InputElementStack nsStack)
Method called by the input element stack to indicate that
it has just added local namespace declarations from the
current element, and is about to start resolving element
and attribute namespace bindings.
|
protected void |
doAddDefaultValue(DTDAttribute attr) |
protected void |
doReportValidationProblem(String msg,
Location loc) |
String |
getAttributeType(int index) |
int |
getIdAttrIndex()
Method for finding out the index of the attribute (collected using
the attribute collector; having DTD-derived info in same order)
that is of type ID.
|
protected abstract ElementIdMap |
getIdMap() |
int |
getNotationAttrIndex()
Method for finding out the index of the attribute (collected using
the attribute collector; having DTD-derived info in same order)
that is of type NOTATION.
|
org.codehaus.stax2.validation.XMLValidationSchema |
getSchema() |
boolean |
hasNsDefaults() |
boolean |
mayHaveNsDefaults(String elemPrefix,
String elemLN)
Calling this method before
checkNsDefaults(com.ctc.wstx.sr.InputElementStack) is necessary
to pass information regarding the current element; although
it will become available later on (via normal XMLValidator interface),
that's too late (after namespace binding and resolving). |
abstract boolean |
reallyValidating() |
void |
setAttrValueNormalization(boolean state)
Method that allows enabling/disabling attribute value normalization.
|
abstract String |
validateAttribute(String localName,
String uri,
String prefix,
char[] valueChars,
int valueStart,
int valueEnd) |
abstract String |
validateAttribute(String localName,
String uri,
String prefix,
String value) |
abstract int |
validateElementAndAttributes() |
abstract int |
validateElementEnd(String localName,
String uri,
String prefix) |
abstract void |
validateElementStart(String localName,
String uri,
String prefix)
Method called to update information about the newly encountered (start)
element.
|
void |
validateText(char[] cbuf,
int textStart,
int textEnd,
boolean lastTextSegment) |
void |
validateText(String text,
boolean lastTextSegment) |
abstract void |
validationCompleted(boolean eod) |
protected static final HashMap<PrefixedName,DTDAttribute> NO_ATTRS
protected static final HashMap<String,EntityDecl> EMPTY_MAP
protected boolean mNormAttrs
protected DTDElement mCurrElem
validateElementStart,
validateAttribute,
validateElementAndAttributes calls.protected DTDElement[] mElems
protected int mElemCount
mElems.protected HashMap<PrefixedName,DTDAttribute> mCurrAttrDefs
protected DTDAttribute[] mAttrSpecs
protected int mAttrCount
mAttrSpecs; needed to store in case type information
is requested later on.protected int mIdAttrIndex
protected final transient PrefixedName mTmpKey
public DTDValidatorBase(DTDSubset schema, org.codehaus.stax2.validation.ValidationContext ctxt, boolean hasNsDefaults, Map<PrefixedName,DTDElement> elemSpecs, Map<String,EntityDecl> genEntities)
public void setAttrValueNormalization(boolean state)
public abstract boolean reallyValidating()
public final org.codehaus.stax2.validation.XMLValidationSchema getSchema()
getSchema in class org.codehaus.stax2.validation.XMLValidatorpublic abstract void validateElementStart(String localName, String uri, String prefix) throws XMLStreamException
validateElementStart in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic abstract String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException
validateAttribute in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic abstract String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException
validateAttribute in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic abstract int validateElementAndAttributes()
throws XMLStreamException
validateElementAndAttributes in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic abstract int validateElementEnd(String localName, String uri, String prefix) throws XMLStreamException
validateElementEnd in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic void validateText(String text, boolean lastTextSegment) throws XMLStreamException
validateText in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic void validateText(char[] cbuf,
int textStart,
int textEnd,
boolean lastTextSegment)
throws XMLStreamException
validateText in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic abstract void validationCompleted(boolean eod)
throws XMLStreamException
validationCompleted in class org.codehaus.stax2.validation.XMLValidatorXMLStreamExceptionpublic String getAttributeType(int index)
getAttributeType in class org.codehaus.stax2.validation.XMLValidatorpublic int getIdAttrIndex()
getIdAttrIndex in class org.codehaus.stax2.validation.XMLValidatorpublic int getNotationAttrIndex()
getNotationAttrIndex in class org.codehaus.stax2.validation.XMLValidatorpublic boolean mayHaveNsDefaults(String elemPrefix, String elemLN)
checkNsDefaults(com.ctc.wstx.sr.InputElementStack) is necessary
to pass information regarding the current element; although
it will become available later on (via normal XMLValidator interface),
that's too late (after namespace binding and resolving).mayHaveNsDefaults in interface NsDefaultProviderpublic void checkNsDefaults(InputElementStack nsStack) throws XMLStreamException
NsDefaultProvidercheckNsDefaults in interface NsDefaultProviderXMLStreamExceptionprotected abstract ElementIdMap getIdMap()
public boolean hasNsDefaults()
protected void doReportValidationProblem(String msg, Location loc) throws XMLStreamException
XMLStreamExceptionprotected void doAddDefaultValue(DTDAttribute attr) throws XMLStreamException
XMLStreamExceptionCopyright © 2012–2015 FasterXML. All rights reserved.