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.
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Method gets a namespace uri for a prefix.
 java.lang.String getPrefix(java.lang.String namespaceURI)
          Method gets the Prefix for a namespace uri.
 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)

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.


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