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

public final Class CompactNsContext

extends BaseNsContext
Class Inheritance
Imports
java.io.IOException, .Writer, java.util.ArrayList, .Iterator, javax.xml.XMLConstants, javax.xml.stream.Location, .XMLStreamException, .XMLStreamWriter, javax.xml.stream.events.Namespace, org.codehaus.stax2.ri.evt.NamespaceEventImpl, com.ctc.wstx.util.BaseNsContext, .DataUtil

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

Modifier and TypeField and Description
pack-priv final int
mFirstLocalNs

Index of first namespace pair in mNamespaces that is declared in scope of element for which this context was constructed.

pack-priv final Location
pack-priv final String[]
mNamespaces

Array that contains 2 Strings for each declared default namespace (including default namespace declarations); first is the prefix, second URI.

pack-priv final int
mNsLength

Number of entries in mNamespaces (which is twice the number of bindings)

pack-priv transient ArrayList<Namespace>
mNsList

List only needed to support List accessor from start-element event; created lazily if/as needed.

Inherited from com.ctc.wstx.util.BaseNsContext:
UNDECLARED_NS_URI

Constructor Summary

AccessConstructor and Description
public
CompactNsContext(Location loc, String[] namespaces, int nsLen, int firstLocal)

Method Summary

Modifier and TypeMethod and Description
public String
doGetNamespaceURI(String
Non-null, non-empty prefix (base-class verifies these constraints) to find namespace URI for.
prefix
)

Implements abstract com.ctc.wstx.util.BaseNsContext.doGetNamespaceURI.

public String
public Iterator<String>
public Iterator<Namespace>
public void
outputNamespaceDeclarations(Writer w)

Implements abstract com.ctc.wstx.util.BaseNsContext.outputNamespaceDeclarations.

Method called by com.ctc.wstx.evt.CompactStartElement to output all 'local' namespace declarations active in current namespace scope, if any.

public void
Inherited from com.ctc.wstx.util.BaseNsContext:
getNamespaceURIgetPrefixgetPrefixes

Field Detail

mFirstLocalNsback to summary
pack-priv final int mFirstLocalNs

Index of first namespace pair in mNamespaces that is declared in scope of element for which this context was constructed. May be equal to mNsLength (which indicates there are no local bindings).

mLocationback to summary
pack-priv final Location mLocation
mNamespacesback to summary
pack-priv final String[] mNamespaces

Array that contains 2 Strings for each declared default namespace (including default namespace declarations); first is the prefix, second URI.

mNsLengthback to summary
pack-priv final int mNsLength

Number of entries in mNamespaces (which is twice the number of bindings)

mNsListback to summary
pack-priv transient ArrayList<Namespace> mNsList

List only needed to support List accessor from start-element event; created lazily if/as needed.

Constructor Detail

CompactNsContextback to summary
public CompactNsContext(Location loc, String[] namespaces, int nsLen, int firstLocal)

Method Detail

doGetNamespaceURIback to summary
public String doGetNamespaceURI(String prefix)

Implements abstract com.ctc.wstx.util.BaseNsContext.doGetNamespaceURI.

Parameters
prefix:String

Non-null, non-empty prefix (base-class verifies these constraints) to find namespace URI for.

Annotations
@Override
doGetPrefixback to summary
public String doGetPrefix(String nsURI)

Implements abstract com.ctc.wstx.util.BaseNsContext.doGetPrefix.

Annotations
@Override
doGetPrefixesback to summary
public Iterator<String> doGetPrefixes(String nsURI)

Implements abstract com.ctc.wstx.util.BaseNsContext.doGetPrefixes.

Annotations
@Override
getNamespacesback to summary
public Iterator<Namespace> getNamespaces()

Implements abstract com.ctc.wstx.util.BaseNsContext.getNamespaces.

Annotations
@Override
outputNamespaceDeclarationsback to summary
public void outputNamespaceDeclarations(Writer w) throws IOException

Implements abstract com.ctc.wstx.util.BaseNsContext.outputNamespaceDeclarations.

Method called by com.ctc.wstx.evt.CompactStartElement 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.

Annotations
@Override
outputNamespaceDeclarationsback to summary
public void outputNamespaceDeclarations(XMLStreamWriter w) throws XMLStreamException

Implements abstract com.ctc.wstx.util.BaseNsContext.outputNamespaceDeclarations.

Annotations
@Override