APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.util

public Class NamespaceContextWrapper

extends Object
implements NamespaceContext
Class Inheritance
All Implemented Interfaces
javax.xml.namespace.NamespaceContext
Imports
java.util.Iterator, .List, javax.xml.namespace.NamespaceContext

Writing a wrapper to re-use most of the namespace functionality already provided by NamespaceSupport, which implements NamespaceContext from XNI. It would be good if we can change the XNI NamespaceContext interface to implement the JAXP NamespaceContext interface. Note that NamespaceSupport assumes the use of symbols. Since this class can be exposed to the application, we must intern all Strings before calling NamespaceSupport methods.
Authors
Neeraj Bajaj, Santiago PericasGeertsen

Field Summary

Modifier and TypeField and Description
private NamespaceContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public NamespaceContext
getNamespaceContext()

This method supports all functions in the NamespaceContext utility class

public String
getNamespaceURI(String prefix)

Implements javax.xml.namespace.NamespaceContext.getNamespaceURI.

Get Namespace URI bound to a prefix in the current scope.

public String
getPrefix(String namespaceURI)

Implements javax.xml.namespace.NamespaceContext.getPrefix.

Get prefix bound to Namespace URI in the current scope.

public Iterator<String>
getPrefixes(String namespaceURI)

Implements javax.xml.namespace.NamespaceContext.getPrefixes.

Todo

Namespace doesn't give information giving multiple prefixes for the same namespaceURI.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fNamespaceContextback to summary
private NamespaceContext fNamespaceContext

Constructor Detail

NamespaceContextWrapperback to summary
public NamespaceContextWrapper(NamespaceSupport namespaceContext)

Method Detail

getNamespaceContextback to summary
public NamespaceContext getNamespaceContext()

This method supports all functions in the NamespaceContext utility class

getNamespaceURIback to summary
public String getNamespaceURI(String prefix)

Implements javax.xml.namespace.NamespaceContext.getNamespaceURI.

Doc from javax.xml.namespace.NamespaceContext.getNamespaceURI.

Get Namespace URI bound to a prefix in the current scope.

When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:

Return value for specified prefixes
prefix parameter Namespace URI return value
DEFAULT_NS_PREFIX ("") default Namespace URI in the current scope or XMLConstants.NULL_NS_URI("") when there is no default Namespace URI in the current scope
bound prefix Namespace URI bound to prefix in current scope
unbound prefix XMLConstants.NULL_NS_URI("")
XMLConstants.XML_NS_PREFIX ("xml") XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")
null IllegalArgumentException is thrown
getPrefixback to summary
public String getPrefix(String namespaceURI)

Implements javax.xml.namespace.NamespaceContext.getPrefix.

Doc from javax.xml.namespace.NamespaceContext.getPrefix.

Get prefix bound to Namespace URI in the current scope.

To get all prefixes bound to a Namespace URI in the current scope, use getPrefixes(String namespaceURI).

When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:

Return value for specified Namespace URIs
Namespace URI parameter prefix value returned
<default Namespace URI> XMLConstants.DEFAULT_NS_PREFIX ("")
bound Namespace URI prefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned
unbound Namespace URI null
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace") XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/") XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
null IllegalArgumentException is thrown
getPrefixesback to summary
public Iterator<String> getPrefixes(String namespaceURI)

Implements javax.xml.namespace.NamespaceContext.getPrefixes.

Todo

Namespace doesn't give information giving multiple prefixes for the same namespaceURI.