public final class DTDElement
extends java.lang.Object
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).
Modifier and Type | Field and Description |
---|---|
(package private) int |
mAllowedContent |
(package private) boolean |
mAnyDefaults
Flag set to true if there are any attributes that have either
basic default value, or #FIXED default value.
|
(package private) boolean |
mAnyFixed |
(package private) java.util.HashMap<PrefixedName,DTDAttribute> |
mAttrMap |
(package private) DTDAttribute |
mIdAttr
Id attribute instance, if one already declared for this element;
can only have up to one such attribute per element.
|
(package private) javax.xml.stream.Location |
mLocation
Location of the (real) definition of the element; may be null for
placeholder elements created to hold ATTLIST definitions
|
(package private) PrefixedName |
mName |
(package private) DTDAttribute |
mNotationAttr
Notation attribute instance, if one already declared for this element;
can only have up to one such attribute per element.
|
(package private) boolean |
mNsAware
True if the DTD was parsed (and is to be used) in namespace-aware
mode.
|
(package private) java.util.HashMap<java.lang.String,DTDAttribute> |
mNsDefaults
Set of namespace declarations with default values, if any
(regular ns pseudo-attr declarations are just ignored)
|
(package private) java.util.ArrayList<DTDAttribute> |
mSpecAttrList
Ordered list of attributes that have 'special' properties (attribute
is required, has a default value [regular or fixed]); these attributes
have to be specifically checked after actual values have been resolved.
|
(package private) boolean |
mValidateAttrs
Flag that is set to true if there is at least one attribute that
has type that requires normalization and/or validation; that is,
is of some other type than CDATA.
|
(package private) StructValidator |
mValidator
Base validator object for validating content model of this element;
may be null for some simple content models (ANY, EMPTY).
|
(package private) boolean |
mXml11
True if the DTD was parsed in xml1.1 compliant mode (referenced to
from an xml 1.1 document).
|
Modifier | Constructor and Description |
---|---|
private |
DTDElement(javax.xml.stream.Location loc,
PrefixedName name,
StructValidator val,
int allowedContent,
boolean nsAware,
boolean xml11) |
Modifier and Type | Method and Description |
---|---|
DTDAttribute |
addAttribute(InputProblemReporter rep,
PrefixedName attrName,
int valueType,
DefaultAttrValue defValue,
WordResolver enumValues,
boolean fullyValidate)
Method called by DTD parser when it has read information about
an attribute that belong to this element
|
DTDAttribute |
addNsDefault(InputProblemReporter rep,
PrefixedName attrName,
int valueType,
DefaultAttrValue defValue,
boolean fullyValidate)
Method called to add a definition of a namespace-declaration
pseudo-attribute with a default value.
|
boolean |
attrsNeedValidation() |
static DTDElement |
createDefined(ReaderConfig cfg,
javax.xml.stream.Location loc,
PrefixedName name,
StructValidator val,
int allowedContent)
Method called to create an actual element definition, matching
an ELEMENT directive in a DTD subset.
|
static DTDElement |
createPlaceholder(ReaderConfig cfg,
javax.xml.stream.Location loc,
PrefixedName 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,
boolean fullyValidate)
Method called to "upgrade" a placeholder using a defined element,
including adding attributes.
|
private DTDAttribute |
doAddAttribute(java.util.Map<PrefixedName,DTDAttribute> attrMap,
InputProblemReporter rep,
DTDAttribute attr,
java.util.List<DTDAttribute> specList,
boolean fullyValidate) |
int |
getAllowedContent() |
int |
getAllowedContentIfSpace()
Specialized accessor used by non-validating but typing 'validator':
essentially, used to figure out whether #PCDATA is allowed or not;
and based on that, return one of 2 allowable text values (only
space, or anything).
|
java.util.HashMap<PrefixedName,DTDAttribute> |
getAttributes() |
java.lang.String |
getDisplayName() |
DTDAttribute |
getIdAttribute() |
javax.xml.stream.Location |
getLocation() |
PrefixedName |
getName() |
DTDAttribute |
getNotationAttribute() |
protected java.util.HashMap<java.lang.String,DTDAttribute> |
getNsDefaults() |
java.util.List<DTDAttribute> |
getSpecialAttrs() |
int |
getSpecialCount() |
private java.util.List<DTDAttribute> |
getSpecialList() |
StructValidator |
getValidator() |
boolean |
hasAttrDefaultValues() |
boolean |
hasFixedAttrs() |
boolean |
hasNsDefaults() |
boolean |
isDefined() |
void |
mergeMissingAttributesFrom(InputProblemReporter rep,
DTDElement other,
boolean fullyValidate) |
java.lang.String |
toString() |
private void |
verifyUndefined() |
final PrefixedName mName
final javax.xml.stream.Location mLocation
StructValidator mValidator
int mAllowedContent
final boolean mNsAware
final boolean mXml11
java.util.HashMap<PrefixedName,DTDAttribute> mAttrMap
java.util.ArrayList<DTDAttribute> mSpecAttrList
boolean mAnyFixed
boolean mAnyDefaults
boolean mValidateAttrs
DTDAttribute mIdAttr
DTDAttribute mNotationAttr
java.util.HashMap<java.lang.String,DTDAttribute> mNsDefaults
private DTDElement(javax.xml.stream.Location loc, PrefixedName name, StructValidator val, int allowedContent, boolean nsAware, boolean xml11)
public static DTDElement createDefined(ReaderConfig cfg, javax.xml.stream.Location loc, PrefixedName name, StructValidator val, int allowedContent)
public static DTDElement createPlaceholder(ReaderConfig cfg, javax.xml.stream.Location loc, PrefixedName name)
public DTDElement define(javax.xml.stream.Location loc, StructValidator val, int allowedContent)
public void defineFrom(InputProblemReporter rep, DTDElement definedElem, boolean fullyValidate) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void verifyUndefined()
public DTDAttribute addAttribute(InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, WordResolver enumValues, boolean fullyValidate) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public DTDAttribute addNsDefault(InputProblemReporter rep, PrefixedName attrName, int valueType, DefaultAttrValue defValue, boolean fullyValidate) throws javax.xml.stream.XMLStreamException
rep
- Reporter to use to report non-fatal problemsfullyValidate
- Whether this is being invoked for actual DTD validation,
or just the "typing non-validator"javax.xml.stream.XMLStreamException
public void mergeMissingAttributesFrom(InputProblemReporter rep, DTDElement other, boolean fullyValidate) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private DTDAttribute doAddAttribute(java.util.Map<PrefixedName,DTDAttribute> attrMap, InputProblemReporter rep, DTDAttribute attr, java.util.List<DTDAttribute> specList, boolean fullyValidate) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public PrefixedName getName()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDisplayName()
public javax.xml.stream.Location getLocation()
public boolean isDefined()
public int getAllowedContent()
public int getAllowedContentIfSpace()
public java.util.HashMap<PrefixedName,DTDAttribute> getAttributes()
public int getSpecialCount()
public java.util.List<DTDAttribute> getSpecialAttrs()
public boolean attrsNeedValidation()
public boolean hasFixedAttrs()
public boolean hasAttrDefaultValues()
public DTDAttribute getIdAttribute()
public DTDAttribute getNotationAttribute()
public boolean hasNsDefaults()
public StructValidator getValidator()
protected java.util.HashMap<java.lang.String,DTDAttribute> getNsDefaults()
private java.util.List<DTDAttribute> getSpecialList()