|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.xml.NamespaceBindings
public class NamespaceBindings
Modifiable prefix to namespace (and namespace to prefix) mappings for dealing with qualified names and XPath expressions.
This class implements both org.jaxen.NamespaceContext
and the
javax.xml.namespace.NamespaceContext
interfaces.
Constructor Summary | |
---|---|
NamespaceBindings()
Creates a new instance of NamespaceContext with no bindings. |
|
NamespaceBindings(NamespaceBindings nsContext)
Creates a new instance of NamespaceContext that contains all the bindings from the argument context. |
|
NamespaceBindings(NamespaceContext nsContext,
Collection<String> prefixes)
Creates a new instance of NamespaceContext that contains all the bindings from the given XML namespace
context. |
Method Summary | |
---|---|
NamespaceBindings |
addNamespace(String prefix,
String namespace)
Registers a new prefix with an assigned namespace URI. |
String |
getNamespaceURI(String prefix)
|
Iterator<String> |
getNamespaceURIs()
Returns all bound namespaces. |
String |
getPrefix(String ns)
|
Iterator<String> |
getPrefixes()
Returns all bound prefixes. |
Iterator<String> |
getPrefixes(String ns)
|
String |
toString()
|
String |
translateNamespacePrefixToUri(String prefix)
Returns the namespace mapping for the given prefix (Jaxen method). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NamespaceBindings()
NamespaceContext
with no bindings.
public NamespaceBindings(NamespaceBindings nsContext)
NamespaceContext
that contains all the bindings from the argument context.
nsContext
- bindings to copy, must not be null
public NamespaceBindings(NamespaceContext nsContext, Collection<String> prefixes)
NamespaceContext
that contains all the bindings from the given XML namespace
context.
nsContext
- bindings to copy, must not be null
Method Detail |
---|
public NamespaceBindings addNamespace(String prefix, String namespace)
prefix
- prefix, must not be null
namespace
- namespace, may be null
public String translateNamespacePrefixToUri(String prefix)
Taken from the Jaxen Javadoc: In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI. This method should return null for the empty prefix. Similarly, the prefix "xml" always resolves to the URI "http://www.w3.org/XML/1998/namespace".
prefix
- prefix, may be null
null
(unbound)public Iterator<String> getNamespaceURIs()
null
public String getNamespaceURI(String prefix)
getNamespaceURI
in interface NamespaceContext
public String getPrefix(String ns)
getPrefix
in interface NamespaceContext
public Iterator<String> getPrefixes(String ns)
getPrefixes
in interface NamespaceContext
public Iterator<String> getPrefixes()
null
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |