Package com.jcabi.xml
Class XPathContext
- java.lang.Object
-
- com.jcabi.xml.XPathContext
-
- All Implemented Interfaces:
NamespaceContext
public final class XPathContext extends Object implements NamespaceContext
Convenient internal implementation ofNamespaceContext
.The class is immutable and thread-safe.
- Since:
- 0.1
-
-
Constructor Summary
Constructors Constructor Description XPathContext()
Public ctor.XPathContext(Object... namespaces)
Public ctor with custom namespaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XPathContext
add(String prefix, Object namespace)
Add new prefix and namespace.String
getNamespaceURI(String prefix)
String
getPrefix(String namespace)
Iterator<String>
getPrefixes(String namespace)
XPathContext
merge(NamespaceContext context)
Add new context.String
toString()
-
-
-
Constructor Detail
-
XPathContext
public XPathContext()
Public ctor.Since this class is private in the package users won't be able to see this code and its documentation. That's why all these prefixes and namespaces should be documented in
XMLDocument(String)
ctor. When adding/changing this list - don't forget to document it there.
-
XPathContext
public XPathContext(Object... namespaces)
Public ctor with custom namespaces.- Parameters:
namespaces
- List of namespaces
-
-
Method Detail
-
getNamespaceURI
public String getNamespaceURI(String prefix)
- Specified by:
getNamespaceURI
in interfaceNamespaceContext
-
getPrefix
public String getPrefix(String namespace)
- Specified by:
getPrefix
in interfaceNamespaceContext
-
getPrefixes
public Iterator<String> getPrefixes(String namespace)
- Specified by:
getPrefixes
in interfaceNamespaceContext
-
add
public XPathContext add(String prefix, Object namespace)
Add new prefix and namespace.- Parameters:
prefix
- The prefixnamespace
- The namespace- Returns:
- New context
-
merge
public XPathContext merge(NamespaceContext context)
Add new context.- Parameters:
context
- The context to merge into this one- Returns:
- New context
-
-