com.sun.xml.ws.util
Class NamespaceSupport.Context

java.lang.Object
  extended by com.sun.xml.ws.util.NamespaceSupport.Context
Enclosing class:
NamespaceSupport

static final class NamespaceSupport.Context
extends Object

Internal class for a single Namespace context.

This module caches and reuses Namespace contexts, so the number allocated will be equal to the element depth of the document, not to the total number of elements (i.e. 5-10 rather than tens of thousands).


Field Summary
(package private)  HashMap attributeNameTable
           
(package private)  String defaultNS
           
(package private)  HashMap elementNameTable
           
(package private)  HashMap prefixTable
           
(package private)  HashMap uriTable
           
 
Constructor Summary
NamespaceSupport.Context()
          Create the root-level Namespace context.
NamespaceSupport.Context(NamespaceSupport.Context that, NamespaceSupport.Context newParent)
           
 
Method Summary
(package private)  void declarePrefix(String prefix, String uri)
          Declare a Namespace prefix for this context.
(package private)  Iterable<String> getDeclaredPrefixes()
          Return an enumeration of prefixes declared in this context.
(package private)  String getPrefix(String uri)
          Look up one of the prefixes associated with a URI in this context.
(package private)  Iterable<String> getPrefixes()
          Return an enumeration of all prefixes currently in force.
(package private)  String getURI(String prefix)
          Look up the URI associated with a prefix in this context.
(package private)  String[] processName(String qName, boolean isAttribute)
          Process a raw XML 1.0 name in this context.
(package private)  void setParent(NamespaceSupport.Context parent)
          (Re)set the parent of this Namespace context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefixTable

HashMap prefixTable

uriTable

HashMap uriTable

elementNameTable

HashMap elementNameTable

attributeNameTable

HashMap attributeNameTable

defaultNS

String defaultNS
Constructor Detail

NamespaceSupport.Context

NamespaceSupport.Context()
Create the root-level Namespace context.


NamespaceSupport.Context

NamespaceSupport.Context(NamespaceSupport.Context that,
                         NamespaceSupport.Context newParent)
Method Detail

setParent

void setParent(NamespaceSupport.Context parent)
(Re)set the parent of this Namespace context.

Parameters:
parent - The parent Namespace context object.

declarePrefix

void declarePrefix(String prefix,
                   String uri)
Declare a Namespace prefix for this context.

Parameters:
prefix - The prefix to declare.
uri - The associated Namespace URI.
See Also:
NamespaceSupport.declarePrefix(java.lang.String, java.lang.String)

processName

String[] processName(String qName,
                     boolean isAttribute)
Process a raw XML 1.0 name in this context.

Parameters:
qName - The raw XML 1.0 name.
isAttribute - true if this is an attribute name.
Returns:
An array of three strings containing the URI part (or empty string), the local part, and the raw name, all internalized, or null if there is an undeclared prefix.
See Also:
NamespaceSupport.processName(java.lang.String, java.lang.String[], boolean)

getURI

String getURI(String prefix)
Look up the URI associated with a prefix in this context.

Parameters:
prefix - The prefix to look up.
Returns:
The associated Namespace URI, or null if none is declared.
See Also:
NamespaceSupport.getURI(java.lang.String)

getPrefix

String getPrefix(String uri)
Look up one of the prefixes associated with a URI in this context.

Since many prefixes may be mapped to the same URI, the return value may be unreliable.

Parameters:
uri - The URI to look up.
Returns:
The associated prefix, or null if none is declared.
See Also:
NamespaceSupport.getPrefix(java.lang.String)

getDeclaredPrefixes

Iterable<String> getDeclaredPrefixes()
Return an enumeration of prefixes declared in this context.

Returns:
An enumeration of prefixes (possibly empty).
See Also:
NamespaceSupport.getDeclaredPrefixes()

getPrefixes

Iterable<String> getPrefixes()
Return an enumeration of all prefixes currently in force.

The default prefix, if in force, is not returned, and will have to be checked for separately.

Returns:
An enumeration of prefixes (never empty).
See Also:
NamespaceSupport.getPrefixes()