com.ctc.wstx.dtd
Class ElementValidator

java.lang.Object
  extended bycom.ctc.wstx.dtd.ElementValidator
All Implemented Interfaces:
InputConfigFlags

public class ElementValidator
extends java.lang.Object
implements InputConfigFlags

Class that will be instantiated by specialized instances of InputElementStack, specifically the validating ones (whether namespace-aware or not).


Field Summary
protected  int mAttrCount
          Number of attribute specification Objects in mAttrSpecs.
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  int mElemCount
           
protected  DTDElement[] mElemStack
          Stack of element definitions read from DTD.
protected  int mIdAttrIndex
          Index of the attribute of type ID, within current element's attribute list.
protected  com.ctc.wstx.dtd.ElementIdMap mIdMap
          Information about declared and referenced element ids (unique ids that attributes may defined, as defined by DTD)
protected  StructValidator[] mValidators
          Stack of content structure validators, on matching indexes with element specification objects.
 
Fields inherited from interface com.ctc.wstx.cfg.InputConfigFlags
CFG_CACHE_DTDS, CFG_COALESCE_TEXT, CFG_INTERN_NS_URIS, CFG_LAZY_PARSING, CFG_NAMESPACE_AWARE, CFG_NORMALIZE_ATTR_VALUES, CFG_NORMALIZE_LFS, CFG_PRESERVE_LOCATION, CFG_REPLACE_ENTITY_REFS, CFG_REPORT_ALL_TEXT_AS_CHARACTERS, CFG_REPORT_PROLOG_WS, CFG_SUPPORT_DTD, CFG_SUPPORT_DTDPP, CFG_SUPPORT_EXTERNAL_ENTITIES, CFG_VALIDATE_AGAINST_DTD, CFG_VALIDATE_TEXT_CHARS, CONTENT_ALLOW_DTD_ANY, CONTENT_ALLOW_MIXED, CONTENT_ALLOW_NON_MIXED, CONTENT_ALLOW_NONE, CONTENT_ALLOW_UNDEFINED
 
Constructor Summary
ElementValidator(InputProblemReporter rep, SymbolTable symbols, boolean nsAware, java.util.Map genEntities, AttributeCollector ac, boolean normAttrs)
           
 
Method Summary
 java.lang.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.
 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.
 int pop(InputProblemReporter rep)
           
 int resolveElem(InputProblemReporter rep, DTDElement elem, StringVector ns)
          Method called to update information about the newly encountered (start) element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mElemStack

protected DTDElement[] mElemStack
Stack of element definitions read from DTD.


mElemCount

protected int mElemCount

mValidators

protected StructValidator[] mValidators
Stack of content structure validators, on matching indexes with element specification objects.


mAttrSpecs

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


mAttrCount

protected int mAttrCount
Number of attribute specification Objects in mAttrSpecs.


mIdAttrIndex

protected int mIdAttrIndex
Index of the attribute of type ID, within current element's attribute list. Track of this is kept separate from other attribute since id attributes often need to be used for resolving cross-references.


mIdMap

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

Constructor Detail

ElementValidator

public ElementValidator(InputProblemReporter rep,
                        SymbolTable symbols,
                        boolean nsAware,
                        java.util.Map genEntities,
                        AttributeCollector ac,
                        boolean normAttrs)
Method Detail

pop

public int pop(InputProblemReporter rep)
        throws WstxException
Returns:
Validation state that should be effective for the parent element state
Throws:
WstxException

resolveElem

public int resolveElem(InputProblemReporter rep,
                       DTDElement elem,
                       StringVector ns)
                throws WstxException
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.

Parameters:
rep - Reporter instance that can be used to report back problems (via exceptions)
elem - Element to resolve
ns - (optional) Data structure that contains all currently active namespace declarations; may be needed for resolving namespaced default attributes' namespace URIs.
Returns:
Validation state that should be effective for the fully resolved element context
Throws:
WstxException

getAttributeType

public java.lang.String getAttributeType(int index)

getIdAttrIndex

public 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. DTD explicitly specifies that at most one attribute can have this type for any element.

Returns:
Index of the attribute with type ID, in the current element, if one exists: -1 otherwise

getNotationAttrIndex

public 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. DTD explicitly specifies that at most one attribute can have this type for any element.

Returns:
Index of the attribute with type NOTATION, in the current element, if one exists: -1 otherwise