com.ctc.wstx.dtd
Class DTDElement

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

public final class DTDElement
extends java.lang.Object
implements InputConfigFlags

Class that contains element definitions from DTD.

Notes about thread-safety: this class is not thread-safe, since it does not have to be, in general case. That is, the only instances that can be shared are external subset instances, and those are used in read-only manner (with the exception of temporary arrays constructed on-demand).


Field Summary
 
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
 
Method Summary
 DTDAttribute addAttribute(InputProblemReporter rep, NameKey attrName, int valueType, int defValueType, java.lang.String defValue, WordResolver enumValues)
          Method called by DTD parser when it has read information about an attribute that belong to this element
 boolean attrsNeedValidation()
           
static DTDElement createDefined(javax.xml.stream.Location loc, NameKey name, StructValidator val, int allowedContent)
          Method called to create an actual element definition, matching an ELEMENT directive in a DTD subset.
static DTDElement createPlaceholder(javax.xml.stream.Location loc, NameKey name)
          Method called to create a "placeholder" element definition, needed to contain attribute definitions.
 DTDElement define(javax.xml.stream.Location loc, StructValidator val, int allowedContent)
          Method called on placeholder element, to create a real instance that has all attribute definitions placeholder had (it'll always have at least one -- otherwise no placeholder was needed).
 void defineFrom(InputProblemReporter rep, DTDElement definedElem)
          Method called to "upgrade" a placeholder using a defined element, including adding attributes.
 int getAllowedContent()
           
 java.util.HashMap getAttributes()
           
 java.lang.String getDisplayName()
           
 DTDAttribute getIdAttribute()
           
 javax.xml.stream.Location getLocation()
           
 NameKey getName()
           
 DTDAttribute getNotationAttribute()
           
 java.util.List getSpecialAttrs()
           
 int getSpecialCount()
           
 StructValidator getValidator()
           
 boolean hasFixedAttrs()
           
 boolean isDefined()
           
 void mergeMissingAttributesFrom(InputProblemReporter rep, DTDElement other)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createDefined

public static DTDElement createDefined(javax.xml.stream.Location loc,
                                       NameKey name,
                                       StructValidator val,
                                       int allowedContent)
Method called to create an actual element definition, matching an ELEMENT directive in a DTD subset.


createPlaceholder

public static DTDElement createPlaceholder(javax.xml.stream.Location loc,
                                           NameKey name)
Method called to create a "placeholder" element definition, needed to contain attribute definitions.


define

public DTDElement define(javax.xml.stream.Location loc,
                         StructValidator val,
                         int allowedContent)
Method called on placeholder element, to create a real instance that has all attribute definitions placeholder had (it'll always have at least one -- otherwise no placeholder was needed).


defineFrom

public void defineFrom(InputProblemReporter rep,
                       DTDElement definedElem)
                throws WstxException
Method called to "upgrade" a placeholder using a defined element, including adding attributes.

Throws:
WstxException

addAttribute

public DTDAttribute addAttribute(InputProblemReporter rep,
                                 NameKey attrName,
                                 int valueType,
                                 int defValueType,
                                 java.lang.String defValue,
                                 WordResolver enumValues)
                          throws WstxException
Method called by DTD parser when it has read information about an attribute that belong to this element

Returns:
Newly created attribute Object if the attribute definition was added (hadn't been declared yet); null if it's a duplicate, in which case original definition sticks.
Throws:
WstxException

mergeMissingAttributesFrom

public void mergeMissingAttributesFrom(InputProblemReporter rep,
                                       DTDElement other)
                                throws WstxException
Throws:
WstxException

getName

public NameKey getName()

toString

public java.lang.String toString()

getDisplayName

public java.lang.String getDisplayName()

getLocation

public javax.xml.stream.Location getLocation()

isDefined

public boolean isDefined()

getAllowedContent

public int getAllowedContent()
Returns:
Constant that identifies what kind of nodes are in general allowed inside this element.

getAttributes

public java.util.HashMap getAttributes()

getSpecialCount

public int getSpecialCount()

getSpecialAttrs

public java.util.List getSpecialAttrs()

attrsNeedValidation

public boolean attrsNeedValidation()
Returns:
True if at least one of the attributes has type other than CDATA; false if not

hasFixedAttrs

public boolean hasFixedAttrs()

getIdAttribute

public DTDAttribute getIdAttribute()

getNotationAttribute

public DTDAttribute getNotationAttribute()

getValidator

public StructValidator getValidator()