Top Description Fields Constructors Methods
com.ctc.wstx.dtd

public Class DTDTypingNonValidator

extends DTDValidatorBase
Class Inheritance
Imports
java.util.*, javax.xml.stream.XMLStreamException, org.codehaus.stax2.validation.*, com.ctc.wstx.ent.EntityDecl, com.ctc.wstx.util.DataUtil, .ElementIdMap, .ExceptionUtil, .PrefixedName

This class is a "non-validating validator"; a validator-like object that handles DTD-based non-validation functionality: determining type information and default values. This instance does NOT implement any actual DTD-validation, and is to be used in DTD-aware non-validating mode.

Field Summary

Modifier and TypeField and Description
protected BitSet
mCurrDefaultAttrs

Bitset used for keeping track of defaulted attributes for which values have been found.

protected boolean
mHasAttrDefaults

Flag that indicates if current element has any attributes that have default values.

protected boolean
mHasNormalizableAttrs

Flag that indicates whether any of the attributes is potentially normalizable, and we are in attribute-normalizing mode.

protected BitSet
mTmpDefaultAttrs

Reusable lazily instantiated BitSet; needed to keep track of 'missing' attributes with default values (normal default, #FIXED).

Inherited from com.ctc.wstx.dtd.DTDValidatorBase:
DEFAULT_STACK_SIZEEMPTY_MAPEXP_MAX_ATTRSmAttrCountmAttrSpecsmContextmCurrAttrDefsmCurrElemmElemCountmElemsmElemSpecsmGeneralEntitiesmHasNsDefaultsmIdAttrIndexmNormAttrsmSchemamTmpAttrValueBuffermTmpKeyNO_ATTRS

Constructor Summary

AccessConstructor and Description
public
DTDTypingNonValidator(DTDSubset schema, ValidationContext ctxt, boolean hasNsDefaults, Map<PrefixedName, DTDElement> elemSpecs, Map<String, EntityDecl> genEntities)

Method Summary

Modifier and TypeMethod and Description
protected ElementIdMap
public final boolean

Returns:

False, since this is not a real validator
reallyValidating
()

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.reallyValidating.

public void
setAttrValueNormalization(boolean state)

Overrides com.ctc.wstx.dtd.DTDValidatorBase.setAttrValueNormalization.

This 'validator' will not normalize any attributes, so let's implement this as no-op.

public String
validateAttribute(String localName, String uri, String prefix, String value)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateAttribute.

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.).

public String
validateAttribute(String localName, String uri, String prefix, char[]
Character array that contains value (possibly along with some other text)
valueChars
,
int
Index of the first character of the value in in valueChars array
valueStart
,
int
Index of the character AFTER the last character; so that the length of the value String is valueEnd - valueStart
valueEnd
)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateAttribute.

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.).

public int
validateElementAndAttributes()

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementAndAttributes.

Method called after calling validateAttribute on all attributes (if any), but before starting to handle element content.

public int
validateElementEnd(String localName, String uri, String prefix)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementEnd.

Method called right after encountering an element close tag.

public void
validateElementStart(String localName, String uri, String prefix)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementStart.

Method called to update information about the newly encountered (start) element.

public void
validationCompleted(boolean
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).
eod
)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validationCompleted.

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).

Inherited from com.ctc.wstx.dtd.DTDValidatorBase:
checkNsDefaultsdoAddDefaultValuedoReportValidationProblemgetAttributeTypegetElemNamegetEntityMapgetIdAttrIndexgetLocationgetNotationAttrIndexgetSchemagetTempAttrValueBufferhasNsDefaultsmayHaveNsDefaultsreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemvalidateTextvalidateText

Field Detail

mCurrDefaultAttrsback to summary
protected BitSet mCurrDefaultAttrs

Bitset used for keeping track of defaulted attributes for which values have been found. Only non-null when current element does have such attributes

mHasAttrDefaultsback to summary
protected boolean mHasAttrDefaults

Flag that indicates if current element has any attributes that have default values.

mHasNormalizableAttrsback to summary
protected boolean mHasNormalizableAttrs

Flag that indicates whether any of the attributes is potentially normalizable, and we are in attribute-normalizing mode.

mTmpDefaultAttrsback to summary
protected BitSet mTmpDefaultAttrs

Reusable lazily instantiated BitSet; needed to keep track of 'missing' attributes with default values (normal default, #FIXED).

Constructor Detail

DTDTypingNonValidatorback to summary
public DTDTypingNonValidator(DTDSubset schema, ValidationContext ctxt, boolean hasNsDefaults, Map<PrefixedName, DTDElement> elemSpecs, Map<String, EntityDecl> genEntities)

Method Detail

getIdMapback to summary
protected ElementIdMap getIdMap()

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.getIdMap.

Annotations
@Override
reallyValidatingback to summary
public final boolean reallyValidating()

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.reallyValidating.

Returns:boolean

False, since this is not a real validator

Annotations
@Override
setAttrValueNormalizationback to summary
public void setAttrValueNormalization(boolean state)

Overrides com.ctc.wstx.dtd.DTDValidatorBase.setAttrValueNormalization.

This 'validator' will not normalize any attributes, so let's implement this as no-op.

Annotations
@Override
validateAttributeback to summary
public String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateAttribute.

Doc from org.codehaus.stax2.validation.XMLValidator.validateAttribute.

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.).

Returns:String

Null, if the passed value is fine as is; or a String, if it needs to be replaced. In latter case, caller will replace the value before passing it to other validators. Also, if the attribute value is accessible via caller (as is the case for stream readers), caller should return this value, instead of the original one.

Annotations
@Override
validateAttributeback to summary
public String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateAttribute.

Doc from org.codehaus.stax2.validation.XMLValidator.validateAttribute.

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.).

Parameters
valueChars:char[]

Character array that contains value (possibly along with some other text)

valueStart:int

Index of the first character of the value in in valueChars array

valueEnd:int

Index of the character AFTER the last character; so that the length of the value String is valueEnd - valueStart

Returns:String

Null, if the passed value is fine as is; or a String, if it needs to be replaced. In latter case, caller will replace the value before passing it to other validators. Also, if the attribute value is accessible via caller (as is the case for stream readers), caller should return this value, instead of the original one.

Annotations
@Override
validateElementAndAttributesback to summary
public int validateElementAndAttributes() throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementAndAttributes.

Doc from org.codehaus.stax2.validation.XMLValidator.validateElementAndAttributes.

Method called after calling validateAttribute on all attributes (if any), but before starting to handle element content.

Returns:int

One of CONTENT_ALLOW_ constants, to indicate what kind of textual content is allowed at the scope returned to after the element has closed.

Annotations
@Override
validateElementEndback to summary
public int validateElementEnd(String localName, String uri, String prefix) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementEnd.

Doc from org.codehaus.stax2.validation.XMLValidator.validateElementEnd.

Method called right after encountering an element close tag.

Returns:int

Doc from com.ctc.wstx.dtd.DTDValidatorBase.validateElementEnd.

Validation state that should be effective for the parent element state

Annotations
@Override
validateElementStartback to summary
public void validateElementStart(String localName, String uri, String prefix) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validateElementStart.

Doc from com.ctc.wstx.dtd.DTDValidatorBase.validateElementStart.

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.

Annotations
@Override
validationCompletedback to summary
public void validationCompleted(boolean eod)

Implements abstract com.ctc.wstx.dtd.DTDValidatorBase.validationCompleted.

Doc from org.codehaus.stax2.validation.XMLValidator.validationCompleted.

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).

Parameters
eod:boolean

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).

Annotations
@Override