Package com.ctc.wstx.dtd
Class DTDSubsetImpl
java.lang.Object
com.ctc.wstx.dtd.DTDSubset
com.ctc.wstx.dtd.DTDSubsetImpl
- All Implemented Interfaces:
org.codehaus.stax2.validation.DTDValidationSchema
,org.codehaus.stax2.validation.XMLValidationSchema
The default implementation of
DTDSubset
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final HashMap
<String, EntityDecl> Map (name-to-WEntityDeclaration) that contains all parameter entities defined by this subset.(package private) final HashMap
<PrefixedName, DTDElement> (package private) final boolean
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.(package private) final HashMap
<String, EntityDecl> Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset.(package private) List
<EntityDecl> Lazily instantiated List that contains all notations frommGeneralEntities
(preferably in their declaration order; depends on whether platform, ie.(package private) final boolean
Flag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes.(package private) final boolean
Whether this subset is cachable.(package private) List
<NotationDeclaration> Lazily instantiated List that contains all notations frommNotations
(preferably in their declaration order; depends on whether platform, ie.(package private) final HashMap
<String, NotationDeclaration> Map (name-to-NotationDecl) that this subset has defined.Set of names of general entities references by this subset.Set of names of parameter entities references by this subset.Fields inherited from interface org.codehaus.stax2.validation.XMLValidationSchema
SCHEMA_ID_DTD, SCHEMA_ID_RELAXNG, SCHEMA_ID_TREX, SCHEMA_ID_W3C_SCHEMA
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
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 TypeMethodDescriptionprivate static void
checkNotations
(HashMap<String, NotationDeclaration> fromInt, HashMap<String, NotationDeclaration> fromExt) 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.combineWithExternalSubset
(InputProblemReporter rep, DTDSubset extSubset) Method that will combine definitions from internal and external subsets, producing a single DTD set.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) org.codehaus.stax2.validation.XMLValidator
createValidator
(org.codehaus.stax2.validation.ValidationContext ctxt) int
int
boolean
boolean
isReusableWith
(DTDSubset intSubset) Method used in determining whether cached external subset instance can be used with specified internal subset.static void
throwElementException
(DTDElement oldElem, Location loc) static void
throwNotationException
(NotationDeclaration oldDecl, NotationDeclaration newDecl) toString()
Methods inherited from class com.ctc.wstx.dtd.DTDSubset
getSchemaType
-
Field Details
-
mIsCachable
final boolean mIsCachableWhether 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. -
mFullyValidating
final boolean mFullyValidatingWhether 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. -
mHasNsDefaults
final boolean mHasNsDefaultsFlag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes. -
mGeneralEntities
Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset. -
mGeneralEntityList
Lazily instantiated List that contains all notations frommGeneralEntities
(preferably in their declaration order; depends on whether platform, ie. JDK version, has insertion-ordered Maps available), used by DTD event Objects. -
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.
-
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. -
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.
-
mNotations
Map (name-to-NotationDecl) that this subset has defined. -
mNotationList
Lazily instantiated List that contains all notations frommNotations
(preferably in their declaration order; depends on whether platform, ie. JDK version, has insertion-ordered Maps available), used by DTD event Objects. -
mElements
-
-
Constructor Details
-
DTDSubsetImpl
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 Details
-
constructInstance
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) -
combineWithExternalSubset
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws XMLStreamException Method that will combine definitions from internal and external subsets, producing a single DTD set.- Specified by:
combineWithExternalSubset
in classDTDSubset
- Throws:
XMLStreamException
-
createValidator
public org.codehaus.stax2.validation.XMLValidator createValidator(org.codehaus.stax2.validation.ValidationContext ctxt) throws XMLStreamException - Specified by:
createValidator
in interfaceorg.codehaus.stax2.validation.XMLValidationSchema
- Specified by:
createValidator
in classDTDSubset
- Throws:
XMLStreamException
-
getEntityCount
public int getEntityCount()- Specified by:
getEntityCount
in interfaceorg.codehaus.stax2.validation.DTDValidationSchema
- Specified by:
getEntityCount
in classDTDSubset
-
getNotationCount
public int getNotationCount()- Specified by:
getNotationCount
in interfaceorg.codehaus.stax2.validation.DTDValidationSchema
- Specified by:
getNotationCount
in classDTDSubset
-
isCachable
public boolean isCachable()- Specified by:
isCachable
in classDTDSubset
-
getGeneralEntityMap
- Specified by:
getGeneralEntityMap
in classDTDSubset
-
getGeneralEntityList
- Specified by:
getGeneralEntityList
in classDTDSubset
-
getParameterEntityMap
- Specified by:
getParameterEntityMap
in classDTDSubset
-
getNotationMap
- Specified by:
getNotationMap
in classDTDSubset
-
getNotationList
- Specified by:
getNotationList
in classDTDSubset
-
getElementMap
- Specified by:
getElementMap
in classDTDSubset
-
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.- Specified by:
isReusableWith
in classDTDSubset
- Returns:
- True if this (external) subset refers to a parameter entity defined in passed-in internal subset.
-
toString
-
throwNotationException
public static void throwNotationException(NotationDeclaration oldDecl, NotationDeclaration newDecl) throws XMLStreamException - Throws:
XMLStreamException
-
throwElementException
public static void throwElementException(DTDElement oldElem, Location loc) throws XMLStreamException - Throws:
XMLStreamException
-
combineMaps
Note: The first Map argument WILL be modified; second one not. Caller needs to ensure this is acceptable.
-
combineElements
private void combineElements(InputProblemReporter rep, HashMap<PrefixedName, DTDElement> intElems, HashMap<PrefixedName, throws XMLStreamExceptionDTDElement> 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. Care has to be taken to only check actual redeclarations: placeholders should not cause problems.- Throws:
XMLStreamException
-
checkNotations
private static void checkNotations(HashMap<String, NotationDeclaration> fromInt, HashMap<String, throws XMLStreamExceptionNotationDeclaration> fromExt) - Throws:
XMLStreamException
-