Package com.ctc.wstx.dtd
Class DTDSubsetImpl
- java.lang.Object
-
- com.ctc.wstx.dtd.DTDSubset
-
- com.ctc.wstx.dtd.DTDSubsetImpl
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.HashMap<java.lang.String,EntityDecl>
mDefinedPEs
Map (name-to-WEntityDeclaration) that contains all parameter entities defined by this subset.(package private) java.util.HashMap<PrefixedName,DTDElement>
mElements
(package private) 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.(package private) java.util.HashMap<java.lang.String,EntityDecl>
mGeneralEntities
Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset.(package private) java.util.List<EntityDecl>
mGeneralEntityList
Lazily instantiated List that contains all notations frommGeneralEntities
(preferably in their declaration order; depends on whether platform, ie.(package private) boolean
mHasNsDefaults
Flag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes.(package private) boolean
mIsCachable
Whether this subset is cachable.(package private) java.util.List<javax.xml.stream.events.NotationDeclaration>
mNotationList
Lazily instantiated List that contains all notations frommNotations
(preferably in their declaration order; depends on whether platform, ie.(package private) java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration>
mNotations
Map (name-to-NotationDecl) that this subset has defined.(package private) java.util.Set<java.lang.String>
mRefdGEs
Set of names of general entities references by this subset.(package private) java.util.Set<java.lang.String>
mRefdPEs
Set of names of parameter entities references by this subset.
-
Constructor Summary
Constructors Modifier Constructor Description private
DTDSubsetImpl(boolean cachable, java.util.HashMap<java.lang.String,EntityDecl> genEnt, java.util.Set<java.lang.String> refdGEs, java.util.HashMap<java.lang.String,EntityDecl> paramEnt, java.util.Set<java.lang.String> peRefs, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> notations, java.util.HashMap<PrefixedName,DTDElement> elements, boolean fullyValidating)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
checkNotations(java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> fromInt, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> fromExt)
private void
combineElements(InputProblemReporter rep, java.util.HashMap<PrefixedName,DTDElement> intElems, java.util.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>
voidcombineMaps(java.util.Map<K,V> m1, java.util.Map<K,V> m2)
Note: The first Map argument WILL be modified; second one not.DTDSubset
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, java.util.HashMap<java.lang.String,EntityDecl> genEnt, java.util.Set<java.lang.String> refdGEs, java.util.HashMap<java.lang.String,EntityDecl> paramEnt, java.util.Set<java.lang.String> refdPEs, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> notations, java.util.HashMap<PrefixedName,DTDElement> elements, boolean fullyValidating)
org.codehaus.stax2.validation.XMLValidator
createValidator(org.codehaus.stax2.validation.ValidationContext ctxt)
java.util.HashMap<PrefixedName,DTDElement>
getElementMap()
int
getEntityCount()
java.util.List<EntityDecl>
getGeneralEntityList()
java.util.HashMap<java.lang.String,EntityDecl>
getGeneralEntityMap()
int
getNotationCount()
java.util.List<javax.xml.stream.events.NotationDeclaration>
getNotationList()
java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration>
getNotationMap()
java.util.HashMap<java.lang.String,EntityDecl>
getParameterEntityMap()
boolean
isCachable()
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, javax.xml.stream.Location loc)
static void
throwNotationException(javax.xml.stream.events.NotationDeclaration oldDecl, javax.xml.stream.events.NotationDeclaration newDecl)
java.lang.String
toString()
-
Methods inherited from class com.ctc.wstx.dtd.DTDSubset
getSchemaType
-
-
-
-
Field Detail
-
mIsCachable
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.
-
mFullyValidating
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.
-
mHasNsDefaults
final boolean mHasNsDefaults
Flag that indicates whether any of the elements declarared has any attribute default values for namespace pseudo-attributes.
-
mGeneralEntities
final java.util.HashMap<java.lang.String,EntityDecl> mGeneralEntities
Map (name-to-EntityDecl) of general entity declarations (internal, external) for this DTD subset.
-
mGeneralEntityList
transient volatile java.util.List<EntityDecl> 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
final java.util.Set<java.lang.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.
-
mDefinedPEs
final java.util.HashMap<java.lang.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.
-
mRefdPEs
final java.util.Set<java.lang.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.
-
mNotations
final java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> mNotations
Map (name-to-NotationDecl) that this subset has defined.
-
mNotationList
transient java.util.List<javax.xml.stream.events.NotationDeclaration> 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
final java.util.HashMap<PrefixedName,DTDElement> mElements
-
-
Constructor Detail
-
DTDSubsetImpl
private DTDSubsetImpl(boolean cachable, java.util.HashMap<java.lang.String,EntityDecl> genEnt, java.util.Set<java.lang.String> refdGEs, java.util.HashMap<java.lang.String,EntityDecl> paramEnt, java.util.Set<java.lang.String> peRefs, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> notations, java.util.HashMap<PrefixedName,DTDElement> elements, boolean fullyValidating)
-
-
Method Detail
-
constructInstance
public static DTDSubsetImpl constructInstance(boolean cachable, java.util.HashMap<java.lang.String,EntityDecl> genEnt, java.util.Set<java.lang.String> refdGEs, java.util.HashMap<java.lang.String,EntityDecl> paramEnt, java.util.Set<java.lang.String> refdPEs, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> notations, java.util.HashMap<PrefixedName,DTDElement> elements, boolean fullyValidating)
-
combineWithExternalSubset
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset) throws javax.xml.stream.XMLStreamException
Method that will combine definitions from internal and external subsets, producing a single DTD set.- Specified by:
combineWithExternalSubset
in classDTDSubset
- Throws:
javax.xml.stream.XMLStreamException
-
createValidator
public org.codehaus.stax2.validation.XMLValidator createValidator(org.codehaus.stax2.validation.ValidationContext ctxt) throws javax.xml.stream.XMLStreamException
- Specified by:
createValidator
in interfaceorg.codehaus.stax2.validation.XMLValidationSchema
- Specified by:
createValidator
in classDTDSubset
- Throws:
javax.xml.stream.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
public java.util.HashMap<java.lang.String,EntityDecl> getGeneralEntityMap()
- Specified by:
getGeneralEntityMap
in classDTDSubset
-
getGeneralEntityList
public java.util.List<EntityDecl> getGeneralEntityList()
- Specified by:
getGeneralEntityList
in classDTDSubset
-
getParameterEntityMap
public java.util.HashMap<java.lang.String,EntityDecl> getParameterEntityMap()
- Specified by:
getParameterEntityMap
in classDTDSubset
-
getNotationMap
public java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> getNotationMap()
- Specified by:
getNotationMap
in classDTDSubset
-
getNotationList
public java.util.List<javax.xml.stream.events.NotationDeclaration> getNotationList()
- Specified by:
getNotationList
in classDTDSubset
-
getElementMap
public java.util.HashMap<PrefixedName,DTDElement> getElementMap()
- Specified by:
getElementMap
in classDTDSubset
-
isReusableWith
public boolean isReusableWith(DTDSubset intSubset)
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
throwNotationException
public static void throwNotationException(javax.xml.stream.events.NotationDeclaration oldDecl, javax.xml.stream.events.NotationDeclaration newDecl) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
throwElementException
public static void throwElementException(DTDElement oldElem, javax.xml.stream.Location loc) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
combineMaps
private static <K,V> void combineMaps(java.util.Map<K,V> m1, java.util.Map<K,V> m2)
Note: The first Map argument WILL be modified; second one not. Caller needs to ensure this is acceptable.
-
combineElements
private void combineElements(InputProblemReporter rep, java.util.HashMap<PrefixedName,DTDElement> intElems, java.util.HashMap<PrefixedName,DTDElement> extElems) throws javax.xml.stream.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.- Throws:
javax.xml.stream.XMLStreamException
-
checkNotations
private static void checkNotations(java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> fromInt, java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> fromExt) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
-