public class SimpleNamespaceContext extends Object implements NamespaceContext
NamespaceContext
for binding namespace prefixes to
namespaces. This class implements the full contract as defined by that interface.
It provides a fluent interface style. In its simplest use, it can be constructed
empty or with a single prefix using a constructor. In addition, the methods
addPrefix(String, String)
and defaultNamespace(String)
can be used
to add prefixes and to define the default namespace respectively.Constructor and Description |
---|
SimpleNamespaceContext()
Constructs an empty context without prefixes.
|
SimpleNamespaceContext(String aPrefix,
String aNamespace)
Constructs a context with a single prefix.
|
Modifier and Type | Method and Description |
---|---|
SimpleNamespaceContext |
addPrefix(String aPrefix,
String aNamespace)
Adds a prefix.
|
SimpleNamespaceContext |
defaultNamespace(String aDefaultNs)
Sets the default namespace.
|
String |
getNamespaceURI(String aPrefix) |
String |
getPrefix(String aNamespaceURI) |
Iterator |
getPrefixes(String aNamespaceURI) |
List<String> |
getPrefixList(String aNamespaceURI) |
static SimpleNamespaceContext |
namespaceContext()
Constructs empty context (for use with static imports).
|
static SimpleNamespaceContext |
namespaceContext(String aPrefix,
String aNamespace)
Constructs a context with a single prefix (for use with static imports).
|
static SimpleNamespaceContext |
namespaces()
Creation of the namespace context for use with static imports.
|
public SimpleNamespaceContext()
public static SimpleNamespaceContext namespaces()
public static SimpleNamespaceContext namespaceContext()
public static SimpleNamespaceContext namespaceContext(String aPrefix, String aNamespace)
aPrefix
- PrefixaNamespace
- Namespace.public SimpleNamespaceContext defaultNamespace(String aDefaultNs)
aDefaultNs
- Default namespace.public SimpleNamespaceContext addPrefix(String aPrefix, String aNamespace)
aPrefix
- Prefix to add.aNamespace
- Namespace to bind prefix to.public String getNamespaceURI(String aPrefix)
getNamespaceURI
in interface NamespaceContext
public String getPrefix(String aNamespaceURI)
getPrefix
in interface NamespaceContext
public Iterator getPrefixes(String aNamespaceURI)
getPrefixes
in interface NamespaceContext
Copyright © 2024. All rights reserved.