com.ctc.wstx.dtd
Class DTDValidator

java.lang.Object
  extended by org.codehaus.stax2.validation.XMLValidator
      extended by com.ctc.wstx.dtd.DTDValidatorBase
          extended by com.ctc.wstx.dtd.DTDValidator
All Implemented Interfaces:
NsDefaultProvider

public class DTDValidator
extends DTDValidatorBase

Woodstox implementation of XMLValidator; the class that handles DTD-based validation.


Field Summary
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
 
Fields inherited from class com.ctc.wstx.dtd.DTDValidatorBase
EMPTY_MAP, mAttrCount, mAttrSpecs, mCurrAttrDefs, mCurrElem, mElemCount, mElems, mIdAttrIndex, mNormAttrs, mTmpKey
 
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
DTDValidator(DTDSubset schema, org.codehaus.stax2.validation.ValidationContext ctxt, boolean hasNsDefaults, Map elemSpecs, Map genEntities)
           
 
Method Summary
protected  void checkIdRefs()
           
protected  ElementIdMap getIdMap()
           
 boolean reallyValidating()
           
 String validateAttribute(String localName, String uri, String prefix, char[] valueChars, int valueStart, int valueEnd)
           
 String validateAttribute(String localName, String uri, String prefix, String value)
           
 int validateElementAndAttributes()
           
 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, getIdAttrIndex, getNotationAttrIndex, getSchema, hasNsDefaults, mayHaveNsDefaults, setAttrValueNormalization, validateText, validateText
 
Methods inherited from class org.codehaus.stax2.validation.XMLValidator
getSchemaType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mReportDuplicateErrors

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.


mIdMap

protected ElementIdMap mIdMap
Information about declared and referenced element ids (unique ids that attributes may defined, as defined by DTD)


mValidators

protected StructValidator[] mValidators
Stack of validators for open elements


mCurrSpecialAttrs

protected BitSet mCurrSpecialAttrs
Bitset used for keeping track of required and defaulted attributes for which values have been found.

Constructor Detail

DTDValidator

public DTDValidator(DTDSubset schema,
                    org.codehaus.stax2.validation.ValidationContext ctxt,
                    boolean hasNsDefaults,
                    Map elemSpecs,
                    Map genEntities)
Method Detail

reallyValidating

public final boolean reallyValidating()
Specified by:
reallyValidating in class DTDValidatorBase
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 class DTDValidatorBase
Throws:
XMLStreamException

validateAttribute

public String validateAttribute(String localName,
                                String uri,
                                String prefix,
                                String value)
                         throws XMLStreamException
Specified by:
validateAttribute in class DTDValidatorBase
Throws:
XMLStreamException

validateAttribute

public String validateAttribute(String localName,
                                String uri,
                                String prefix,
                                char[] valueChars,
                                int valueStart,
                                int valueEnd)
                         throws XMLStreamException
Specified by:
validateAttribute in class DTDValidatorBase
Throws:
XMLStreamException

validateElementAndAttributes

public int validateElementAndAttributes()
                                 throws XMLStreamException
Specified by:
validateElementAndAttributes in class DTDValidatorBase
Throws:
XMLStreamException

validateElementEnd

public int validateElementEnd(String localName,
                              String uri,
                              String prefix)
                       throws XMLStreamException
Specified by:
validateElementEnd in class DTDValidatorBase
Returns:
Validation state that should be effective for the parent element state
Throws:
XMLStreamException

validationCompleted

public void validationCompleted(boolean eod)
                         throws XMLStreamException
Specified by:
validationCompleted in class DTDValidatorBase
Throws:
XMLStreamException

getIdMap

protected ElementIdMap getIdMap()
Specified by:
getIdMap in class DTDValidatorBase

checkIdRefs

protected void checkIdRefs()
                    throws XMLStreamException
Throws:
XMLStreamException


Copyright © 2011 Codehaus. All Rights Reserved.