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

public final Class DTDSubsetImpl

extends DTDSubset
Class Inheritance
Imports
java.text.MessageFormat, java.util.*, javax.xml.stream.Location, .XMLStreamException, javax.xml.stream.events.NotationDeclaration, org.codehaus.stax2.validation.*, com.ctc.wstx.cfg.ErrorConsts, com.ctc.wstx.ent.EntityDecl, com.ctc.wstx.exc.WstxParsingException, com.ctc.wstx.sr.InputProblemReporter, com.ctc.wstx.util.DataUtil, .PrefixedName

The default implementation of DTDSubset

Field Summary

Modifier and TypeField and Description
pack-priv final HashMap<String, EntityDecl>
mDefinedPEs

Map (name-to-WEntityDeclaration) that contains all parameter entities defined by this subset.

pack-priv final HashMap<PrefixedName, DTDElement>
pack-priv final boolean
mFullyValidating

Whether this subset has full validation information; and consequently whether it will do actual validation, or just allow access to type information, notations, entities, and add default attribute values.

pack-priv final HashMap<String, EntityDecl>
mGeneralEntities

Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset.

pack-priv transient volatile List<EntityDecl>
mGeneralEntityList

Lazily instantiated List that contains all notations from mGeneralEntities (preferably in their declaration order; depends on whether platform, ie.

pack-priv final boolean
mHasNsDefaults

Flag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes.

pack-priv final boolean
mIsCachable

Whether this subset is cachable.

pack-priv transient List<NotationDeclaration>
mNotationList

Lazily instantiated List that contains all notations from mNotations (preferably in their declaration order; depends on whether platform, ie.

pack-priv final HashMap<String, NotationDeclaration>
mNotations

Map (name-to-NotationDecl) that this subset has defined.

pack-priv final Set<String>
mRefdGEs

Set of names of general entities references by this subset.

pack-priv final Set<String>
mRefdPEs

Set of names of parameter entities references by this subset.

Constructor Summary

AccessConstructor and Description
private
DTDSubsetImpl(boolean cachable, HashMap<String, EntityDecl> genEnt, Set<String> refdGEs, HashMap<String, EntityDecl> paramEnt, Set<String> peRefs, HashMap<String, NotationDeclaration> notations, HashMap<PrefixedName, DTDElement> elements, boolean fullyValidating)

Method Summary

Modifier and TypeMethod and Description
private static void
private void
combineElements(InputProblemReporter rep, HashMap<PrefixedName, DTDElement> intElems, HashMap<PrefixedName, DTDElement> extElems)

Method that will try to merge in elements defined in the external subset, into internal subset; it will also check for redeclarations when doing this, as it's invalid to redeclare elements.

private static <K, V> void
combineMaps(Map<K, V> m1, Map<K, V> m2)

Note

The first Map argument WILL be modified; second one not.

public DTDSubset
combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset)

Implements abstract com.ctc.wstx.dtd.DTDSubset.combineWithExternalSubset.

Method that will combine definitions from internal and external subsets, producing a single DTD set.

public static DTDSubsetImpl
constructInstance(boolean cachable, HashMap<String, EntityDecl> genEnt, Set<String> refdGEs, HashMap<String, EntityDecl> paramEnt, Set<String> refdPEs, HashMap<String, NotationDeclaration> notations, HashMap<PrefixedName, DTDElement> elements, boolean fullyValidating)

public XMLValidator
public HashMap<PrefixedName, DTDElement>
public int
public List<EntityDecl>
public HashMap<String, EntityDecl>
public int
public synchronized List<NotationDeclaration>
public HashMap<String, NotationDeclaration>
public HashMap<String, EntityDecl>
public boolean
public boolean

Returns:

True if this (external) subset refers to a parameter entity defined in passed-in internal subset.
isReusableWith
(DTDSubset intSubset)

Implements abstract com.ctc.wstx.dtd.DTDSubset.isReusableWith.

Method used in determining whether cached external subset instance can be used with specified internal subset.

public static void
public static void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from com.ctc.wstx.dtd.DTDSubset:
getSchemaType

Field Detail

mDefinedPEsback to summary
pack-priv final HashMap<String, EntityDecl> mDefinedPEs

Map (name-to-WEntityDeclaration) that contains all parameter entities defined by this subset. May be empty if such information will not be needed for use; for example, external subset's definitions are needed, nor are combined DTD set's.

mElementsback to summary
pack-priv final HashMap<PrefixedName, DTDElement> mElements
mFullyValidatingback to summary
pack-priv final boolean mFullyValidating

Whether this subset has full validation information; and consequently whether it will do actual validation, or just allow access to type information, notations, entities, and add default attribute values.

mGeneralEntitiesback to summary
pack-priv final HashMap<String, EntityDecl> mGeneralEntities

Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset.

mGeneralEntityListback to summary
pack-priv transient volatile List<EntityDecl> mGeneralEntityList

Lazily instantiated List that contains all notations from mGeneralEntities (preferably in their declaration order; depends on whether platform, ie. JDK version, has insertion-ordered Maps available), used by DTD event Objects.

mHasNsDefaultsback to summary
pack-priv final boolean mHasNsDefaults

Flag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes.

mIsCachableback to summary
pack-priv final boolean mIsCachable

Whether this subset is cachable. Only those external subsets that do not refer to PEs defined by internal subsets (or GEs via default attribute value expansion) are cachable.

mNotationListback to summary
pack-priv transient List<NotationDeclaration> mNotationList

Lazily instantiated List that contains all notations from mNotations (preferably in their declaration order; depends on whether platform, ie. JDK version, has insertion-ordered Maps available), used by DTD event Objects.

mNotationsback to summary
pack-priv final HashMap<String, NotationDeclaration> mNotations

Map (name-to-NotationDecl) that this subset has defined.

mRefdGEsback to summary
pack-priv final Set<String> mRefdGEs

Set of names of general entities references by this subset. Note that only those GEs that are referenced by default attribute value definitions count, since GEs in text content are only expanded when reading documents, but attribute default values are expanded when reading DTD subset itself.

Needed for determinining if external subset materially depends on definitions from internal subset; if so, such subset is not cachable. This also means that information is not stored for non-cachable instance.

mRefdPEsback to summary
pack-priv final Set<String> mRefdPEs

Set of names of parameter entities references by this subset. Needed when determinining if external subset materially depends on definitions from internal subset, which is needed to know when caching external subsets.

Needed for determinining if external subset materially depends on definitions from internal subset; if so, such subset is not cachable. This also means that information is not stored for non-cachable instance.

Constructor Detail

DTDSubsetImplback to summary
private DTDSubsetImpl(boolean cachable, HashMap<String, EntityDecl> genEnt, Set<String> refdGEs, HashMap<String, EntityDecl> paramEnt, Set<String> peRefs, HashMap<String, NotationDeclaration> notations, HashMap<PrefixedName, DTDElement> elements, boolean fullyValidating)

Method Detail

checkNotationsback to summary
private static void checkNotations(HashMap<String, NotationDeclaration> fromInt, HashMap<String, NotationDeclaration> fromExt) throws XMLStreamException
combineElementsback to summary
private void combineElements(InputProblemReporter rep, HashMap<PrefixedName, DTDElement> intElems, HashMap<PrefixedName, DTDElement> extElems) throws XMLStreamException

Method that will try to merge in elements defined in the external subset, into internal subset; it will also check for redeclarations when doing this, as it's invalid to redeclare elements. Care has to be taken to only check actual redeclarations: placeholders should not cause problems.

combineMapsback to summary
private static <K, V> void combineMaps(Map<K, V> m1, Map<K, V> m2)

Note

The first Map argument WILL be modified; second one not. Caller needs to ensure this is acceptable.

combineWithExternalSubsetback to summary
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDSubset.combineWithExternalSubset.

Method that will combine definitions from internal and external subsets, producing a single DTD set.

Annotations
@Override
constructInstanceback to summary
public static DTDSubsetImpl constructInstance(boolean cachable, HashMap<String, EntityDecl> genEnt, Set<String> refdGEs, HashMap<String, EntityDecl> paramEnt, Set<String> refdPEs, HashMap<String, NotationDeclaration> notations, HashMap<PrefixedName, DTDElement> elements, boolean fullyValidating)
createValidatorback to summary
public XMLValidator createValidator(ValidationContext ctxt) throws XMLStreamException

Implements abstract com.ctc.wstx.dtd.DTDSubset.createValidator.

Implements org.codehaus.stax2.validation.XMLValidationSchema.createValidator.

Annotations
@Override
getElementMapback to summary
public HashMap<PrefixedName, DTDElement> getElementMap()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getElementMap.

Annotations
@Override
getEntityCountback to summary
public int getEntityCount()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getEntityCount.

Implements org.codehaus.stax2.validation.DTDValidationSchema.getEntityCount.

Returns:int

Doc from org.codehaus.stax2.validation.DTDValidationSchema.getEntityCount.

Number of general (non-parameter) entities (of all types) declared in this DTD schema (in subsets [internal, external] included)

Annotations
@Override
getGeneralEntityListback to summary
public List<EntityDecl> getGeneralEntityList()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getGeneralEntityList.

Annotations
@Override
getGeneralEntityMapback to summary
public HashMap<String, EntityDecl> getGeneralEntityMap()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getGeneralEntityMap.

Annotations
@Override
getNotationCountback to summary
public int getNotationCount()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getNotationCount.

Implements org.codehaus.stax2.validation.DTDValidationSchema.getNotationCount.

Returns:int

Doc from org.codehaus.stax2.validation.DTDValidationSchema.getNotationCount.

Number of notations declared in this DTD schema (in subsets [internal, external] included)

Annotations
@Override
getNotationListback to summary
public synchronized List<NotationDeclaration> getNotationList()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getNotationList.

Annotations
@Override
getNotationMapback to summary
public HashMap<String, NotationDeclaration> getNotationMap()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getNotationMap.

Annotations
@Override
getParameterEntityMapback to summary
public HashMap<String, EntityDecl> getParameterEntityMap()

Implements abstract com.ctc.wstx.dtd.DTDSubset.getParameterEntityMap.

Annotations
@Override
isCachableback to summary
public boolean isCachable()

Implements abstract com.ctc.wstx.dtd.DTDSubset.isCachable.

Annotations
@Override
isReusableWithback to summary
public boolean isReusableWith(DTDSubset intSubset)

Implements abstract com.ctc.wstx.dtd.DTDSubset.isReusableWith.

Method used in determining whether cached external subset instance can be used with specified internal subset. If ext. subset references any parameter/general entities int subset (re-)defines, it can not; otherwise it can be used.

Returns:boolean

True if this (external) subset refers to a parameter entity defined in passed-in internal subset.

Annotations
@Override
throwElementExceptionback to summary
public static void throwElementException(DTDElement oldElem, Location loc) throws XMLStreamException
throwNotationExceptionback to summary
public static void throwNotationException(NotationDeclaration oldDecl, NotationDeclaration newDecl) throws XMLStreamException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override