com.ctc.wstx.sr
Class CompactNsContext

java.lang.Object
  extended by com.ctc.wstx.util.BaseNsContext
      extended by com.ctc.wstx.sr.CompactNsContext
All Implemented Interfaces:
javax.xml.namespace.NamespaceContext

public final class CompactNsContext
extends BaseNsContext

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
 
Fields inherited from class com.ctc.wstx.util.BaseNsContext
UNDECLARED_NS_URI
 
Constructor Summary
CompactNsContext(javax.xml.stream.Location loc, java.lang.String defaultNsURI, java.lang.String[] namespaces, int nsLen, int firstLocal)
           
 
Method Summary
 java.lang.String doGetNamespaceURI(java.lang.String prefix)
           
 java.lang.String doGetPrefix(java.lang.String nsURI)
           
 java.util.Iterator doGetPrefixes(java.lang.String nsURI)
           
 java.util.Iterator getNamespaces()
           
 void outputNamespaceDeclarations(java.io.Writer w)
          Method called by CompactStartElement to output all 'local' namespace declarations active in current namespace scope, if any.
 void outputNamespaceDeclarations(javax.xml.stream.XMLStreamWriter w)
           
 
Methods inherited from class com.ctc.wstx.util.BaseNsContext
getNamespaceURI, getPrefix, getPrefixes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompactNsContext

public CompactNsContext(javax.xml.stream.Location loc,
                        java.lang.String defaultNsURI,
                        java.lang.String[] namespaces,
                        int nsLen,
                        int firstLocal)
Method Detail

doGetNamespaceURI

public java.lang.String doGetNamespaceURI(java.lang.String prefix)
Specified by:
doGetNamespaceURI in class BaseNsContext

doGetPrefix

public java.lang.String doGetPrefix(java.lang.String nsURI)
Specified by:
doGetPrefix in class BaseNsContext

doGetPrefixes

public java.util.Iterator doGetPrefixes(java.lang.String nsURI)
Specified by:
doGetPrefixes in class BaseNsContext

getNamespaces

public java.util.Iterator getNamespaces()
Specified by:
getNamespaces in class BaseNsContext

outputNamespaceDeclarations

public void outputNamespaceDeclarations(java.io.Writer w)
                                 throws java.io.IOException
Method called by 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.

Specified by:
outputNamespaceDeclarations in class BaseNsContext
Throws:
java.io.IOException

outputNamespaceDeclarations

public void outputNamespaceDeclarations(javax.xml.stream.XMLStreamWriter w)
                                 throws javax.xml.stream.XMLStreamException
Specified by:
outputNamespaceDeclarations in class BaseNsContext
Throws:
javax.xml.stream.XMLStreamException