Class BaseElement
- java.lang.Object
-
- org.dom4j.tree.AbstractNode
-
- org.dom4j.tree.AbstractBranch
-
- org.dom4j.tree.AbstractElement
-
- org.dom4j.tree.BaseElement
-
- Direct Known Subclasses:
NonLazyElement
public class BaseElement extends AbstractElement
BaseElement
is a useful base class for implemementation inheritence of an XML element.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Attribute>
attributes
list of attributesprotected java.util.List<Node>
content
List of content nodes.-
Fields inherited from class org.dom4j.tree.AbstractElement
USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING
-
Fields inherited from class org.dom4j.tree.AbstractBranch
DEFAULT_CONTENT_LIST_SIZE
-
Fields inherited from class org.dom4j.tree.AbstractNode
NODE_TYPE_NAMES
-
Fields inherited from interface org.dom4j.Node
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
-
-
Constructor Summary
Constructors Constructor Description BaseElement(java.lang.String name)
BaseElement(java.lang.String name, Namespace namespace)
BaseElement(QName qname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<Attribute>
attributeList()
DOCUMENT ME!protected java.util.List<Attribute>
attributeList(int size)
DOCUMENT ME!void
clearContent()
Clears the content for this branch, removing anyNode
instances this branch may contain.protected java.util.List<Node>
contentList()
DOCUMENT ME!Document
getDocument()
getDocument
returns theDocument
that thisNode
is part of if this node supports the parent relationship.Element
getParent()
getParent
returns the parentElement
if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.QName
getQName()
Returns theQName
of this element which represents the local name, the qualified name and theNamespace
.protected void
setAttributeList(java.util.List<Attribute> attributeList)
void
setAttributes(java.util.List<Attribute> attributes)
Sets the attributes that this element containsvoid
setContent(java.util.List<Node> content)
Sets the contents of this branch as aList
ofNode
instances.void
setDocument(Document document)
setDocument
sets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.void
setParent(Element parent)
setParent
sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.void
setQName(QName name)
Sets theQName
of this element which represents the local name, the qualified name and theNamespace
.boolean
supportsParent()
supportsParent
returns true if this node supports the parent relationship.-
Methods inherited from class org.dom4j.tree.AbstractElement
accept, add, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, additionalNamespaces, additionalNamespaces, addNamespace, addNewNode, addNewNode, addNode, addNode, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attribute, attribute, attribute, attribute, attributeCount, attributeIterator, attributes, attributeValue, attributeValue, attributeValue, attributeValue, createAttributeList, createAttributeList, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, declaredNamespaces, element, element, element, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getData, getDocumentFactory, getName, getNamespace, getNamespaceForPrefix, getNamespaceForURI, getNamespacePrefix, getNamespacesForURI, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getStringValue, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, childAdded, childRemoved, indexOf, isRootElement, isTextOnly, node, nodeCount, nodeIterator, normalize, processingInstruction, processingInstructions, processingInstructions, remove, remove, remove, remove, remove, remove, remove, remove, remove, removeNode, removeProcessingInstruction, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, toString, write
-
Methods inherited from class org.dom4j.tree.AbstractBranch
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructions
-
Methods inherited from class org.dom4j.tree.AbstractNode
asXPathResult, clone, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.dom4j.Branch
addElement, addElement, appendContent, content, elementByID, setProcessingInstructions
-
Methods inherited from interface org.dom4j.Element
getText, getTextTrim
-
Methods inherited from interface org.dom4j.Node
asXPathResult, clone, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
-
-
-
-
Method Detail
-
getParent
public Element getParent()
Description copied from interface:Node
getParent
returns the parentElement
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.- Specified by:
getParent
in interfaceNode
- Overrides:
getParent
in classAbstractNode
- Returns:
- the parent of this node or null if it is the root of the tree or the parent relationship is not supported.
-
setParent
public void setParent(Element parent)
Description copied from interface:Node
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.- Specified by:
setParent
in interfaceNode
- Overrides:
setParent
in classAbstractNode
- Parameters:
parent
- is the new parent of this node.
-
getDocument
public Document getDocument()
Description copied from interface:Node
getDocument
returns theDocument
that thisNode
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.- Specified by:
getDocument
in interfaceNode
- Overrides:
getDocument
in classAbstractNode
- Returns:
- the document of this node or null if this feature is not
supported or the node is not associated with a
Document
-
setDocument
public void setDocument(Document document)
Description copied from interface:Node
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.- Specified by:
setDocument
in interfaceNode
- Overrides:
setDocument
in classAbstractNode
- Parameters:
document
- is the new document of this node.
-
supportsParent
public boolean supportsParent()
Description copied from interface:Node
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.
- Specified by:
supportsParent
in interfaceNode
- Overrides:
supportsParent
in classAbstractNode
- Returns:
- true if this node supports the parent relationship or false it is not supported
-
getQName
public QName getQName()
Description copied from interface:Element
Returns theQName
of this element which represents the local name, the qualified name and theNamespace
.- Returns:
- the
QName
associated with this element
-
setQName
public void setQName(QName name)
Description copied from interface:Element
Sets theQName
of this element which represents the local name, the qualified name and theNamespace
.- Parameters:
name
- is theQName
to be associated with this element
-
clearContent
public void clearContent()
Description copied from interface:Branch
Clears the content for this branch, removing anyNode
instances this branch may contain.
-
setContent
public void setContent(java.util.List<Node> content)
Description copied from interface:Branch
Sets the contents of this branch as aList
ofNode
instances.- Parameters:
content
- is the list of nodes to use as the content for this branch.
-
setAttributes
public void setAttributes(java.util.List<Attribute> attributes)
Description copied from interface:Element
Sets the attributes that this element contains- Parameters:
attributes
- DOCUMENT ME!
-
contentList
protected java.util.List<Node> contentList()
Description copied from class:AbstractBranch
DOCUMENT ME!- Specified by:
contentList
in classAbstractBranch
- Returns:
- the internal List used to manage the content
-
attributeList
protected java.util.List<Attribute> attributeList()
Description copied from class:AbstractElement
DOCUMENT ME!- Specified by:
attributeList
in classAbstractElement
- Returns:
- the internal List used to store attributes or creates one if one is not available
-
attributeList
protected java.util.List<Attribute> attributeList(int size)
Description copied from class:AbstractElement
DOCUMENT ME!- Specified by:
attributeList
in classAbstractElement
- Parameters:
size
- DOCUMENT ME!- Returns:
- the internal List used to store attributes or creates one with the specified size if one is not available
-
setAttributeList
protected void setAttributeList(java.util.List<Attribute> attributeList)
-
-