Top Description Fields Constructors Methods
org.dom4j.tree

public Class BaseElement

extends AbstractElement
Class Inheritance
Known Direct Subclasses
org.dom4j.util.NonLazyElement
Imports
org.dom4j.*, java.util.List

BaseElement is a useful base class for implemementation inheritence of an XML element.

Author
James Strachan
Version
$Revision: 1.9 $

Field Summary

Modifier and TypeField and Description
protected List<Attribute>
attributes

list of attributes

protected List<Node>
content

List of content nodes.

private Branch
parentBranch

Stores the parent branch of this node which is either a Document if this element is the root element in a document, or another Element if it is a child of the root document, or null if it has not been added to a document yet.

private QName
qname

The QName for this element

Inherited from org.dom4j.tree.AbstractElement:
USE_STRINGVALUE_SEPARATORVERBOSE_TOSTRING

Constructor Summary

AccessConstructor and Description
public
public
public
BaseElement(String name, Namespace namespace)

Method Summary

Modifier and TypeMethod and Description
protected List<Attribute>
protected List<Attribute>
attributeList(int
DOCUMENT ME!
size
)

Implements abstract org.dom4j.tree.AbstractElement.attributeList.

DOCUMENT ME!
public void
clearContent()

Implements org.dom4j.Branch.clearContent.

Clears the content for this branch, removing any Node instances this branch may contain.
protected List<Node>
contentList()

Implements abstract org.dom4j.tree.AbstractBranch.contentList.

DOCUMENT ME!
public Document
getDocument()

Overrides org.dom4j.tree.AbstractNode.getDocument.

Implements org.dom4j.Node.getDocument.

getDocument returns the Document that this Node is part of if this node supports the parent relationship.

public Element
getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

public QName
getQName()

Implements org.dom4j.Element.getQName.

Returns the QName of this element which represents the local name, the qualified name and the Namespace.
protected void
public void
setAttributes(List<Attribute>
DOCUMENT ME!
attributes
)

Implements org.dom4j.Element.setAttributes.

Sets the attributes that this element contains
public void
setContent(List<Node>
is the list of nodes to use as the content for this branch.
content
)

Implements org.dom4j.Branch.setContent.

Sets the contents of this branch as a List of Node instances.
public void
setDocument(Document
is the new document of this node.
document
)

Overrides org.dom4j.tree.AbstractNode.setDocument.

Implements org.dom4j.Node.setDocument.

setDocument sets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public void
setParent(Element
is the new parent of this node.
parent
)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public void
setQName(QName
is the QName to be associated with this element
name
)

Implements org.dom4j.Element.setQName.

Sets the QName of this element which represents the local name, the qualified name and the Namespace.
public boolean
supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Inherited from org.dom4j.tree.AbstractElement:
acceptaddaddaddaddaddaddaddaddaddaddAttributeaddAttributeaddCDATAaddCommentaddElementaddEntityadditionalNamespacesadditionalNamespacesaddNamespaceaddNewNodeaddNewNodeaddNodeaddNodeaddProcessingInstructionaddProcessingInstructionaddTextappendAttributesasXMLattributeattributeattributeattributeattributeCountattributeIteratorattributesattributeValueattributeValueattributeValueattributeValuechildAddedchildRemovedcreateAttributeListcreateAttributeListcreateCopycreateCopycreateCopycreateElementcreateElementcreateSingleIteratordeclaredNamespaceselementelementelementelementIteratorelementIteratorelementIteratorelementIteratorelementselementselementselementselementTextelementTextelementTextTrimelementTextTrimensureAttributesCapacitygetDatagetDocumentFactorygetNamegetNamespacegetNamespaceForPrefixgetNamespaceForURIgetNamespacePrefixgetNamespacesForURIgetNamespaceURIgetNodeTypegetPathgetQNamegetQualifiedNamegetStringValuegetUniquePathgetXPathNameStepgetXPathResulthasMixedContentindexOfisRootElementisTextOnlynodenodeCountnodeIteratornormalizeprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveremoveremoveremoveremoveremoveremoveremoveremoveNoderemoveProcessingInstructionsetAttributessetAttributeValuesetAttributeValuesetDatasetNamesetNamespacesetTexttoStringwrite

Field Detail

attributesback to summary
protected List<Attribute> attributes

list of attributes

contentback to summary
protected List<Node> content

List of content nodes.

parentBranchback to summary
private Branch parentBranch

Stores the parent branch of this node which is either a Document if this element is the root element in a document, or another Element if it is a child of the root document, or null if it has not been added to a document yet.

qnameback to summary
private QName qname

The QName for this element

Constructor Detail

BaseElementback to summary
public BaseElement(String name)
BaseElementback to summary
public BaseElement(QName qname)
BaseElementback to summary
public BaseElement(String name, Namespace namespace)

Method Detail

attributeListback to summary
protected List<Attribute> attributeList()

Implements abstract org.dom4j.tree.AbstractElement.attributeList.

Doc from org.dom4j.tree.AbstractElement.attributeList.

DOCUMENT ME!

Returns:List<Attribute>

the internal List used to store attributes or creates one if one is not available

attributeListback to summary
protected List<Attribute> attributeList(int size)

Implements abstract org.dom4j.tree.AbstractElement.attributeList.

Doc from org.dom4j.tree.AbstractElement.attributeList.

DOCUMENT ME!

Parameters
size:int

DOCUMENT ME!

Returns:List<Attribute>

the internal List used to store attributes or creates one with the specified size if one is not available

clearContentback to summary
public void clearContent()

Implements org.dom4j.Branch.clearContent.

Doc from org.dom4j.Branch.clearContent.

Clears the content for this branch, removing any Node instances this branch may contain.

contentListback to summary
protected List<Node> contentList()

Implements abstract org.dom4j.tree.AbstractBranch.contentList.

Doc from org.dom4j.tree.AbstractBranch.contentList.

DOCUMENT ME!

Returns:List<Node>

the internal List used to manage the content

getDocumentback to summary
public Document getDocument()

Overrides org.dom4j.tree.AbstractNode.getDocument.

Implements org.dom4j.Node.getDocument.

Doc from org.dom4j.Node.getDocument.

getDocument returns the Document that this Node is part of if this node supports the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Document

the document of this node or null if this feature is not supported or the node is not associated with a Document

getParentback to summary
public Element getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

Doc from org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Element

the parent of this node or null if it is the root of the tree or the parent relationship is not supported.

getQNameback to summary
public QName getQName()

Implements org.dom4j.Element.getQName.

Doc from org.dom4j.Element.getQName.

Returns the QName of this element which represents the local name, the qualified name and the Namespace.

Returns:QName

the QName associated with this element

setAttributeListback to summary
protected void setAttributeList(List<Attribute> attributeList)
setAttributesback to summary
public void setAttributes(List<Attribute> attributes)

Implements org.dom4j.Element.setAttributes.

Doc from org.dom4j.Element.setAttributes.

Sets the attributes that this element contains

Parameters
attributes:List<Attribute>

DOCUMENT ME!

setContentback to summary
public void setContent(List<Node> content)

Implements org.dom4j.Branch.setContent.

Doc from org.dom4j.Branch.setContent.

Sets the contents of this branch as a List of Node instances.

Parameters
content:List<Node>

is the list of nodes to use as the content for this branch.

setDocumentback to summary
public void setDocument(Document document)

Overrides org.dom4j.tree.AbstractNode.setDocument.

Implements org.dom4j.Node.setDocument.

Doc from org.dom4j.Node.setDocument.

setDocument sets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside a Document implementation method and is not intended for general use.

Parameters
document:Document

is the new document of this node.

setParentback to summary
public void setParent(Element parent)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

Doc from org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside an Element implementation method and is not intended for general use.

Parameters
parent:Element

is the new parent of this node.

setQNameback to summary
public void setQName(QName name)

Implements org.dom4j.Element.setQName.

Doc from org.dom4j.Element.setQName.

Sets the QName of this element which represents the local name, the qualified name and the Namespace.

Parameters
name:QName

is the QName to be associated with this element

supportsParentback to summary
public boolean supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

Doc from org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

Returns:boolean

true if this node supports the parent relationship or false it is not supported