com.sun.xml.bind.serializer
Class NamespaceContextImpl

java.lang.Object
  extended by com.sun.xml.bind.serializer.NamespaceContextImpl
All Implemented Interfaces:
NamespaceContext2, javax.xml.namespace.NamespaceContext

Deprecated. in JAXB1.0.1

public class NamespaceContextImpl
extends java.lang.Object
implements NamespaceContext2

Implementation of the NamespaceContext2. This class also provides several utility methods for XMLSerializer-derived classes. The startElement method and the endElement method need to be called appropriately when used. See javadoc for those methods for details.

Since:
JAXB1.0

Constructor Summary
NamespaceContextImpl()
          Deprecated.  
 
Method Summary
 java.lang.String declareNamespace(java.lang.String namespaceUri, boolean requirePrefix)
          Deprecated. Declares a new namespace binding within the current context.
 void endElement()
          Deprecated. Ends the current element context and gets back to the parent context.
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Deprecated. Obtains the namespace URI currently associated to the given prefix.
 java.lang.String getPrefix(java.lang.String namespaceUri)
          Deprecated.  
 java.util.Iterator getPrefixes(java.lang.String namespaceUri)
          Deprecated.  
 void iterateDeclaredPrefixes(PrefixCallback callback)
          Deprecated. Iterates all newly declared namespace prefixes for this element.
 void startElement()
          Deprecated. Sets the current bindings aside and starts a new element context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceContextImpl

public NamespaceContextImpl()
Deprecated. 
Method Detail

declareNamespace

public java.lang.String declareNamespace(java.lang.String namespaceUri,
                                         boolean requirePrefix)
Deprecated. 
Description copied from interface: NamespaceContext2
Declares a new namespace binding within the current context.

The prefix is automatically assigned by MarshallingContext. If a given namespace URI is already declared, nothing happens.

It is NOT an error to declare the same namespace URI more than once.

For marshalling to work correctly, all namespace bindings for an element must be declared between its startElement method and its endAttributes event. Calling the same method with the same parameter between the endAttributes and the endElement returns the same prefix.

Specified by:
declareNamespace in interface NamespaceContext2
requirePrefix - If this parameter is true, this method must assign a prefix to this namespace, even if it's already bound to the default namespace. IOW, this method will never return null if this flag is true. This functionality is necessary to declare namespace URI used for attribute names.
Returns:
returns the assigned prefix. If the namespace is bound to the default namespace, null is returned.

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceUri)
Deprecated. 
Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Deprecated. 
Obtains the namespace URI currently associated to the given prefix. If no namespace URI is associated, return null.

Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext

getPrefixes

public java.util.Iterator getPrefixes(java.lang.String namespaceUri)
Deprecated. 
Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext

startElement

public void startElement()
Deprecated. 
Sets the current bindings aside and starts a new element context. This method should be called at the beginning of the startElement method of the Serializer implementation.


endElement

public void endElement()
Deprecated. 
Ends the current element context and gets back to the parent context. This method should be called at the end of the endElement method of derived classes.


iterateDeclaredPrefixes

public void iterateDeclaredPrefixes(PrefixCallback callback)
                             throws org.xml.sax.SAXException
Deprecated. 
Iterates all newly declared namespace prefixes for this element.

Throws:
org.xml.sax.SAXException