org.n52.security.common.xml
Class SimpleNamespaceContext

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

public class SimpleNamespaceContext
extends Object
implements NamespaceContext

Simple NamespaceContext implementation.

It is possible to register more than one prefix per namespace. Internally it uses two maps and a prefix set to fulfill the interface specification.

If your xml contains a default namespace than you have to register it with the empty string or 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()
           
 
Method Summary
 SimpleNamespaceContext add(String prefix, String namespace)
          Method adds a prefix to namespace mapping.
 SimpleNamespaceContext addAll(Map<String,String> 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.
 String getNamespaceURI(String prefix)
          Returns a namespace URI for a prefix.
 Iterator<String> getNamespaceURIs()
           
 String getPrefix(String namespaceURI)
          Return the prefix for a namespace URI.
 Iterator<String> getPrefixes()
           
 Iterator<String> getPrefixes(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()
Method Detail

getNamespaceURI

public String getNamespaceURI(String prefix)
Returns a namespace URI for a prefix.

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

getPrefix

public String getPrefix(String namespaceURI)
Return the prefix for a namespace URI.

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

getPrefixes

public Iterator<String> getPrefixes(String namespaceURI)
Method getPrefixes for a namespace uri.

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

getPrefixes

public Iterator<String> getPrefixes()
Returns:
all prefixes within the context.

getNamespaceURIs

public Iterator<String> getNamespaceURIs()
Returns:
all namespace uris within the context.

add

public SimpleNamespaceContext add(String prefix,
                                  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(Map<String,String> 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–2014 52north.org. All rights reserved.