Package com.ctc.wstx.sr
Class CompactNsContext
java.lang.Object
com.ctc.wstx.util.BaseNsContext
com.ctc.wstx.sr.CompactNsContext
- All Implemented Interfaces:
NamespaceContext
Simple implementation of separate non-transient namespace context
object. Created for start-element event by transient namespace
instance updated by stream reader.
Note about implementation: Location information is only needed (and only needs to passed) if access is made via extended interface; one that can return information about actual Namespace event objects.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
Index of first namespace pair in mNamespaces that is declared in scope of element for which this context was constructed.(package private) final Location
(package private) final String[]
Array that contains 2 Strings for each declared default namespace (including default namespace declarations); first is the prefix, second URI.(package private) final int
Number of entries inmNamespaces
(which is twice the number of bindings)List only needed to support List accessor from start-element event; created lazily if/as needed.Fields inherited from class com.ctc.wstx.util.BaseNsContext
UNDECLARED_NS_URI
-
Constructor Summary
ConstructorsConstructorDescriptionCompactNsContext
(Location loc, String[] namespaces, int nsLen, int firstLocal) -
Method Summary
Modifier and TypeMethodDescriptiondoGetNamespaceURI
(String prefix) doGetPrefix
(String nsURI) doGetPrefixes
(String nsURI) void
Method called byCompactStartElement
to output all 'local' namespace declarations active in current namespace scope, if any.void
Methods inherited from class com.ctc.wstx.util.BaseNsContext
getNamespaceURI, getPrefix, getPrefixes
-
Field Details
-
mLocation
-
mNamespaces
Array that contains 2 Strings for each declared default namespace (including default namespace declarations); first is the prefix, second URI. -
mNsLength
final int mNsLengthNumber of entries inmNamespaces
(which is twice the number of bindings) -
mFirstLocalNs
final int mFirstLocalNsIndex of first namespace pair in mNamespaces that is declared in scope of element for which this context was constructed. May be equal tomNsLength
(which indicates there are no local bindings). -
mNsList
List only needed to support List accessor from start-element event; created lazily if/as needed.
-
-
Constructor Details
-
CompactNsContext
-
-
Method Details
-
doGetNamespaceURI
- Specified by:
doGetNamespaceURI
in classBaseNsContext
- Parameters:
prefix
- Non-null, non-empty prefix (base-class verifies these constraints) to find namespace URI for.
-
doGetPrefix
- Specified by:
doGetPrefix
in classBaseNsContext
-
doGetPrefixes
- Specified by:
doGetPrefixes
in classBaseNsContext
-
getNamespaces
- Specified by:
getNamespaces
in classBaseNsContext
-
outputNamespaceDeclarations
Method called byCompactStartElement
to output all 'local' namespace declarations active in current namespace scope, if any. Local means that declaration was done in scope of current element, not in a parent element.- Specified by:
outputNamespaceDeclarations
in classBaseNsContext
- Throws:
IOException
-
outputNamespaceDeclarations
- Specified by:
outputNamespaceDeclarations
in classBaseNsContext
- Throws:
XMLStreamException
-