public class Namespace extends AbstractNode
Namespace
is a Flyweight Namespace that can be shared amongst nodes.
Modifier and Type | Field and Description |
---|---|
protected static NamespaceCache |
cache
Cache of Namespace instances
|
private int |
hashCode
A cached version of the hashcode for efficiency
|
static Namespace |
NO_NAMESPACE
No Namespace present
|
private String |
prefix
The prefix mapped to this namespace
|
private String |
uri
The URI for this namespace
|
static Namespace |
XML_NAMESPACE
XML Namespace
|
NODE_TYPE_NAMES
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
accept is the method used in the Visitor Pattern. |
String |
asXML()
asXML returns the textual XML representation of this
node. |
protected int |
createHashCode()
Factory method to create the hashcode allowing derived classes to change the behaviour
|
protected Node |
createXPathResult(Element parent) |
boolean |
equals(Object object) |
static Namespace |
get(String uri)
A helper method to return the Namespace instance
for no prefix and the URI
|
static Namespace |
get(String prefix,
String uri)
A helper method to return the Namespace instance
for the given prefix and URI
|
short |
getNodeType()
Returns the code according to the type of node.
|
String |
getPath(Element context)
Returns the relative XPath expression which will return a node set
containing the given node such as a/b/@c.
|
String |
getPrefix() |
String |
getStringValue()
Returns the XPath string-value of this node.
|
String |
getText()
Returns the text of this node.
|
String |
getUniquePath(Element context)
Returns the relative unique XPath expression from the given context
which will return a nodeset
of one node which is the current node.
|
String |
getURI() |
int |
hashCode() |
String |
toString() |
asXPathResult, clone, createPattern, createXPath, createXPathFilter, detach, getDocument, getDocumentFactory, getName, getNodeTypeName, getParent, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write
protected static final NamespaceCache cache
public static final Namespace XML_NAMESPACE
public static final Namespace NO_NAMESPACE
private int hashCode
public static Namespace get(String prefix, String uri)
public static Namespace get(String uri)
public short getNodeType()
Node
getNodeType
in interface Node
getNodeType
in class AbstractNode
public int hashCode()
protected int createHashCode()
public String getText()
Node
Returns the text of this node.
getText
in interface Node
getText
in class AbstractNode
public String getStringValue()
Node
getStringValue
in interface Node
getStringValue
in class AbstractNode
public String getPath(Element context)
Node
Returns the relative XPath expression which will return a node set containing the given node such as a/b/@c. No indexing will be used to restrict the path if multiple elements with the same name occur on the path.
context
- is the parent context from which the relative path should
start. If the context is null or the context is not an ancestor of
this node then the path will be absolute and start from the document and so
begin with the '/' character.public String getUniquePath(Element context)
Node
Returns the relative unique XPath expression from the given context which will return a nodeset of one node which is the current node. This method will use the XPath index operator to restrict the path if multiple elements with the same name occur on the path.
context
- is the parent context from which the path should
start. If the context is null or the context is not an ancestor of
this node then the path will start from the document and so
begin with the '/' character.public String asXML()
Node
asXML
returns the textual XML representation of this
node.
public void accept(Visitor visitor)
Node
accept
is the method used in the Visitor Pattern.
visitor
- is the visitor in the Visitor Patternprotected Node createXPathResult(Element parent)
createXPathResult
in class AbstractNode
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses