Top Description Fields Constructors Methods
org.dom4j.tree

public abstract Class AbstractEntity

extends AbstractNode
implements Entity
Class Inheritance
All Implemented Interfaces
org.dom4j.Entity, org.dom4j.Node, java.lang.Cloneable
Known Direct Subclasses
org.dom4j.tree.FlyweightEntity
Imports
java.io.IOException, .Writer, org.dom4j.Element, .Entity, .Visitor

AbstractEntity is an abstract base class for tree implementors to use for implementation inheritence.

Author
James Strachan
Version
$Revision: 1.15 $

Field Summary

Inherited from org.dom4j.tree.AbstractNode:
NODE_TYPE_NAMES

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
accept(Visitor
is the visitor in the Visitor Pattern
visitor
)

Implements org.dom4j.Node.accept.

accept is the method used in the Visitor Pattern.

public String
asXML()

Implements org.dom4j.Node.asXML.

asXML returns the textual XML representation of this node.

public short
getNodeType()

Overrides org.dom4j.tree.AbstractNode.getNodeType.

Implements org.dom4j.Node.getNodeType.

Returns the code according to the type of node.
public String
getPath(Element
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.
context
)

Implements org.dom4j.Node.getPath.

Returns the relative XPath expression which will return a node set containing the given node such as a/b/@c.
public String
getStringValue()

Overrides org.dom4j.tree.AbstractNode.getStringValue.

Implements org.dom4j.Node.getStringValue.

Returns the XPath string-value of this node.
public String
getUniquePath(Element
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.
context
)

Implements org.dom4j.Node.getUniquePath.

Returns the relative unique XPath expression from the given context which will return a nodeset of one node which is the current node.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
write(Writer
is the Writer to output the XML to
writer
)

Overrides org.dom4j.tree.AbstractNode.write.

Implements org.dom4j.Node.write.

write writes this node as the default XML notation for this node.

Inherited from org.dom4j.tree.AbstractNode:
asXPathResultclonecreatePatterncreateXPathcreateXPathFiltercreateXPathResultdetachgetDocumentgetDocumentFactorygetNamegetNodeTypeNamegetParentgetPathgetTextgetUniquePathhasContentisReadOnlymatchesnumberValueOfselectNodesselectNodesselectNodesselectObjectselectSingleNodesetDocumentsetNamesetParentsetTextsupportsParentvalueOf

Constructor Detail

AbstractEntityback to summary
public AbstractEntity()

Method Detail

acceptback to summary
public void accept(Visitor visitor)

Implements org.dom4j.Node.accept.

Doc from org.dom4j.Node.accept.

accept is the method used in the Visitor Pattern.

Parameters
visitor:Visitor

is the visitor in the Visitor Pattern

asXMLback to summary
public String asXML()

Implements org.dom4j.Node.asXML.

Doc from org.dom4j.Node.asXML.

asXML returns the textual XML representation of this node.

Returns:String

the XML representation of this node

getNodeTypeback to summary
public short getNodeType()

Overrides org.dom4j.tree.AbstractNode.getNodeType.

Implements org.dom4j.Node.getNodeType.

Doc from org.dom4j.Node.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.

Returns:short

a W3C DOM complient code for the node type such as ELEMENT_NODE or ATTRIBUTE_NODE

getPathback to summary
public String getPath(Element context)

Implements org.dom4j.Node.getPath.

Doc from org.dom4j.Node.getPath.

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.

Parameters
context:Element

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.

Returns:String

the XPath expression relative to the given context which will return a nodeset containing at least this node.

getStringValueback to summary
public String getStringValue()

Overrides org.dom4j.tree.AbstractNode.getStringValue.

Implements org.dom4j.Node.getStringValue.

Doc from org.dom4j.Node.getStringValue.

Returns the XPath string-value of this node. The behaviour of this method is defined in the XPath specification .

Returns:String

the text from all the child Text and Element nodes appended together.

getUniquePathback to summary
public String getUniquePath(Element context)

Implements org.dom4j.Node.getUniquePath.

Doc from org.dom4j.Node.getUniquePath.

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.

Parameters
context:Element

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.

Returns:String

the XPath expression relative to the given context which will return a nodeset containing just this node.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

writeback to summary
public void write(Writer writer) throws IOException

Overrides org.dom4j.tree.AbstractNode.write.

Implements org.dom4j.Node.write.

Doc from org.dom4j.Node.write.

write writes this node as the default XML notation for this node. If you wish to control the XML output (such as for pretty printing, changing the indentation policy etc.) then please use org.dom4j.io.XMLWriter or its derivations.

Parameters
writer:Writer

is the Writer to output the XML to

Exceptions
IOException:
DOCUMENT ME!