org.dom4j
Class Namespace
java.lang.Object
org.dom4j.tree.AbstractNode
- Cloneable, Node, Serializable
public class Namespace
extends org.dom4j.tree.AbstractNode
Namespace
is a Flyweight Namespace that can be shared amongst
nodes.
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 |
Namespace(String prefix, String uri) - DOCUMENT ME!
|
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) - Checks whether this Namespace equals the given Namespace.
|
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() - DOCUMENT ME!
|
String | getStringValue() - Returns the XPath string-value of this node.
|
String | getText() -
Returns the text of this node.
|
String | getURI() - DOCUMENT ME!
|
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 | getXPathNameStep()
|
int | hashCode() - DOCUMENT ME!
|
String | toString()
|
asXPathResult , clone , createPattern , createXPath , createXPathFilter , createXPathResult , detach , getDocument , getDocumentFactory , getName , getNodeType , getNodeTypeName , getParent , getPath , getStringValue , getText , getUniquePath , hasContent , isReadOnly , matches , numberValueOf , selectNodes , selectNodes , selectNodes , selectObject , selectSingleNode , setDocument , setName , setParent , setText , supportsParent , valueOf , write |
CACHE
protected static final org.dom4j.tree.NamespaceCache CACHE
Cache of Namespace instances
NO_NAMESPACE
public static final Namespace NO_NAMESPACE
No Namespace present
XML_NAMESPACE
public static final Namespace XML_NAMESPACE
XML Namespace
Namespace
public Namespace(String prefix,
String uri)
DOCUMENT ME!
prefix
- is the prefix for this namespaceuri
- is the URI for this namespace
accept
public void accept(Visitor visitor)
accept
is the method used in the Visitor Pattern.
- accept in interface Node
visitor
- is the visitor in the Visitor Pattern
asXML
public String asXML()
asXML
returns the textual XML representation of this node.
- asXML in interface Node
- the XML representation of this node
createHashCode
protected int createHashCode()
Factory method to create the hashcode allowing derived classes to change
the behaviour
equals
public boolean equals(Object object)
Checks whether this Namespace equals the given Namespace. Two Namespaces
are equals if their URI and prefix are equal.
get
public static Namespace get(String uri)
A helper method to return the Namespace instance for no prefix and the
URI
- an interned Namespace object
get
public static Namespace get(String prefix,
String uri)
A helper method to return the Namespace instance for the given prefix and
URI
prefix
- DOCUMENT ME!uri
- DOCUMENT ME!
- an interned Namespace object
getNodeType
public short getNodeType()
Returns the code according to the type of node. This makes processing
nodes polymorphically much easier as the switch statement can be used
instead of multiple if (instanceof) statements.
- getNodeType in interface Node
- getNodeType in interface org.dom4j.tree.AbstractNode
- a W3C DOM complient code for the node type such as ELEMENT_NODE
or ATTRIBUTE_NODE
getPath
public String getPath(Element context)
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.
- getPath in interface Node
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.
- the XPath expression relative to the given context which will
return a nodeset containing at least this node.
getPrefix
public String getPrefix()
DOCUMENT ME!
- the prefix for this
Namespace
.
getStringValue
public String getStringValue()
Returns the XPath string-value of this node. The behaviour of this method
is defined in the
XPath
specification .
- getStringValue in interface Node
- getStringValue in interface org.dom4j.tree.AbstractNode
- the text from all the child Text and Element nodes appended
together.
getText
public String getText()
Returns the text of this node.
- getText in interface Node
- getText in interface org.dom4j.tree.AbstractNode
getURI
public String getURI()
DOCUMENT ME!
- the URI for this
Namespace
.
getUniquePath
public 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. This method
will use the XPath index operator to restrict the path if multiple
elements with the same name occur on the path.
- getUniquePath in interface Node
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.
- the XPath expression relative to the given context which will
return a nodeset containing just this node.
getXPathNameStep
public String getXPathNameStep()
hashCode
public int hashCode()
DOCUMENT ME!
- the hash code based on the qualified name and the URI of the
namespace.
toString
public String toString()
Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by 