Top Description Fields Constructors Methods
org.dom4j.tree

public abstract Class AbstractDocumentType

extends AbstractNode
implements DocumentType
Class Inheritance
All Implemented Interfaces
org.dom4j.DocumentType, org.dom4j.Node, java.lang.Cloneable
Known Direct Subclasses
org.dom4j.tree.DefaultDocumentType
Imports
org.dom4j.DocumentType, .Element, .Visitor, org.dom4j.dtd.Decl, java.io.IOException, .Writer, java.util.Iterator, .List

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

Author
James Strachan
Version
$Revision: 1.17 $

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 String
getName()

Overrides org.dom4j.tree.AbstractNode.getName.

Implements org.dom4j.Node.getName.

getName returns the name 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

Returns:

DOCUMENT ME!
getText
()

Overrides org.dom4j.tree.AbstractNode.getText.

Implements org.dom4j.Node.getText.

Returns the text format of the declarations if applicable, or the empty String
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 void
setName(String
is the new name of this node
name
)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

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:
asXPathResultclonecreatePatterncreateXPathcreateXPathFiltercreateXPathResultdetachgetDocumentgetDocumentFactorygetNodeTypeNamegetParentgetPathgetStringValuegetUniquePathhasContentisReadOnlymatchesnumberValueOfselectNodesselectNodesselectNodesselectObjectselectSingleNodesetDocumentsetParentsetTextsupportsParentvalueOf

Constructor Detail

AbstractDocumentTypeback to summary
public AbstractDocumentType()

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

getNameback to summary
public String getName()

Overrides org.dom4j.tree.AbstractNode.getName.

Implements org.dom4j.Node.getName.

Doc from org.dom4j.Node.getName.

getName returns the name of this node. This is the XML local name of the element, attribute, entity or processing instruction. For CDATA and Text nodes this method will return null.

Returns:String

the XML name 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.

getTextback to summary
public String getText()

Overrides org.dom4j.tree.AbstractNode.getText.

Implements org.dom4j.Node.getText.

Returns the text format of the declarations if applicable, or the empty String

Returns:String

DOCUMENT ME!

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.

setNameback to summary
public void setName(String name)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

Doc from org.dom4j.Node.setName.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
name:String

is the new name of 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!