org.inria.ns.reflex.xml
Class NamespaceContext.Elem

java.lang.Object
  extended by org.inria.ns.reflex.xml.NamespaceContext.Elem
All Implemented Interfaces:
NamespaceContext, NamespaceContext.Mutable
Enclosing interface:
NamespaceContext

public static class NamespaceContext.Elem
extends Object
implements NamespaceContext, NamespaceContext.Mutable

A mutable namespace context backed by an element.

Changes done on this context are reflected on the element.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.NamespaceContext
NamespaceContext.Elem, NamespaceContext.Impl, NamespaceContext.Mutable
 
Field Summary
 
Fields inherited from interface org.inria.ns.reflex.xml.NamespaceContext
VOID_NAMESPACE_CONTEXT
 
Constructor Summary
NamespaceContext.Elem(Element element)
          Create a new mutable namespace context.
 
Method Summary
 void addNamespace(String prefix, String namespaceURI)
          Define a namespace on the underlying element.
 String getNamespaceURI(String prefix)
          Get the namespace URI bound to a prefix.
 Iterator getPrefixes(String namespaceURI)
          Retrieve an iterator on the prefixes bound to the given namespace URI.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceContext.Elem

public NamespaceContext.Elem(Element element)
Create a new mutable namespace context.

Parameters:
element - The element to which the changes are done.
Method Detail

getNamespaceURI

public String getNamespaceURI(String prefix)
Get the namespace URI bound to a prefix.

Specified by:
getNamespaceURI in interface NamespaceContext
Parameters:
prefix - The prefix to lookup. If not found in the underlying element, it is looked up in its parent.
Returns:
The namespace URI bound to the prefix, or "" if not found in the underlying element neither its parent.
See Also:
NamespaceContext.getNamespaceURI(java.lang.String)

addNamespace

public void addNamespace(String prefix,
                         String namespaceURI)
Define a namespace on the underlying element.

Specified by:
addNamespace in interface NamespaceContext.Mutable
Parameters:
prefix - The prefix.
namespaceURI - The namespace URI.
See Also:
NamespaceContext.Mutable.addNamespace(java.lang.String, java.lang.String)

getPrefixes

public Iterator getPrefixes(String namespaceURI)
Retrieve an iterator on the prefixes bound to the given namespace URI.

Specified by:
getPrefixes in interface NamespaceContext
Parameters:
namespaceURI - The namespace URI to look for.
Returns:
A non-null iterator on the prefixes bound to the given namespace URI.
See Also:
NamespaceContext.getPrefixes(java.lang.String)