org.n52.security.common.xml
Class SimpleNamespaceContext

java.lang.Object
  extended by org.n52.security.common.xml.SimpleNamespaceContext
All Implemented Interfaces:
javax.xml.namespace.NamespaceContext

public class SimpleNamespaceContext
extends java.lang.Object
implements javax.xml.namespace.NamespaceContext

Class SimpleNamespaceContext is a simple NamespaceContext implementation.

It is possible to register more as one prefix for a namespace. Internally it uses to maps and a prefix set to fullfill the interface specification.

If your xml contains a default namespace than you have to register it with the empty string or javax.xml.XMLConstants.DEFAULT_NS_PREFIX.

It is not necessary to register the xml or xmlns namespace prefixes.

Usage:
new SimpleNamespaceContext() .add("myns","http://tempuri.org/myns") .add("my2ns","http://tempuri.org/my2ns");

Version:
$Revision: 1.1.2.2 $
Author:
Marko Reiprecht Created on 05.03.2008

Constructor Summary
SimpleNamespaceContext()
          Constructor creates a new instance.
 
Method Summary
 SimpleNamespaceContext add(java.lang.String prefix, java.lang.String namespace)
          Method adds a prefix to namespace mapping.
 SimpleNamespaceContext addAll(java.util.Map prefixNamespaceMap)
          Adds all prefixes and namespaces from the given Map to this context.
 SimpleNamespaceContext addAll(SimpleNamespaceContext ctx)
          Adds all prefixes and namespaces from the given context to this context.
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Method gets a namespace uri for a prefix.
 java.util.Iterator getNamespaceURIs()
           
 java.lang.String getPrefix(java.lang.String namespaceURI)
          Method gets the Prefix for a namespace uri.
 java.util.Iterator getPrefixes()
           
 java.util.Iterator getPrefixes(java.lang.String namespaceURI)
          Method getPrefixes for a namespace uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleNamespaceContext

public SimpleNamespaceContext()
Constructor creates a new instance.

Method Detail

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Method gets a namespace uri for a prefix.

Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getNamespaceURI(String)

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceURI)
Method gets the Prefix for a namespace uri.

Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getPrefix(String)

getPrefixes

public java.util.Iterator getPrefixes(java.lang.String namespaceURI)
Method getPrefixes for a namespace uri.

Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getPrefixes(String)

getPrefixes

public java.util.Iterator getPrefixes()
Returns:
all prefixes within the context.

getNamespaceURIs

public java.util.Iterator getNamespaceURIs()
Returns:
all namespace uris within the context.

add

public SimpleNamespaceContext add(java.lang.String prefix,
                                  java.lang.String namespace)
Method adds a prefix to namespace mapping.

Parameters:
prefix - the prefix.
namespace - the namespace.
Returns:
SimpleNamespaceContext.

addAll

public SimpleNamespaceContext addAll(SimpleNamespaceContext ctx)
Adds all prefixes and namespaces from the given context to this context.

Parameters:
ctx - another simple namespace context.
Returns:
this context.

addAll

public SimpleNamespaceContext addAll(java.util.Map prefixNamespaceMap)
Adds all prefixes and namespaces from the given Map to this context.

Parameters:
prefixNamespaceMap - a map with prefix to namespace mappings.
Returns:
this context.


Copyright © 2004-2009 52north.org. All Rights Reserved.