public class DefaultElement extends AbstractElement
 DefaultElement is the default DOM4J default implementation of
 an XML element.
 
USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRINGDEFAULT_CONTENT_LIST_SIZENODE_TYPE_NAMESANY_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 and Description | 
|---|
| DefaultElement(QName qname) | 
| DefaultElement(QName qname,
              int attributeCount) | 
| DefaultElement(java.lang.String name) | 
| DefaultElement(java.lang.String name,
              Namespace namespace) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(Attribute attribute)Adds the given  Attributeto this element. | 
| java.util.List<Namespace> | additionalNamespaces()Returns any additional namespaces declarations for this element other
 than namespace returned via the  Element.getNamespace()method. | 
| java.util.List<Namespace> | additionalNamespaces(java.lang.String defaultNamespaceURI) | 
| protected void | addNewNode(Node node)Like addNode() but does not require a parent check | 
| Attribute | attribute(int index)Returns the attribute at the specified indexGets the | 
| Attribute | attribute(QName qName)DOCUMENT ME! | 
| Attribute | attribute(java.lang.String name)Returns the attribute with the given name | 
| Attribute | attribute(java.lang.String name,
         Namespace namespace) | 
| int | attributeCount()DOCUMENT ME! | 
| java.util.Iterator<Attribute> | attributeIterator()DOCUMENT ME! | 
| protected java.util.List<Attribute> | attributeList()DOCUMENT ME! | 
| protected java.util.List<Attribute> | attributeList(int size)DOCUMENT ME! | 
| java.util.List<Attribute> | attributes()Returns the  Attributeinstances this element contains as a backedListso that the attributes may be modified directly using theListinterface. | 
| void | clearContent()Clears the content for this branch, removing any  Nodeinstances this branch may contain. | 
| java.lang.Object | clone()clonewill return a deep clone or if this node is
 read-only then clone will return the same instance. | 
| protected java.util.List<Node> | contentList()DOCUMENT ME! | 
| java.util.List<Namespace> | declaredNamespaces()Returns all the namespaces declared by this element. | 
| Element | element(QName qName)Returns the first element for the given fully qualified name. | 
| Element | element(java.lang.String name)Returns the first element for the given local name and any namespace. | 
| Element | element(java.lang.String name,
       Namespace namespace) | 
| Document | getDocument()getDocumentreturns theDocumentthat thisNodeis part of if this node supports the parent
 relationship. | 
| protected DocumentFactory | getDocumentFactory() | 
| Namespace | getNamespaceForPrefix(java.lang.String prefix)Returns the  Namespacewhich is mapped to the given prefix
 or null if it could not be found. | 
| Namespace | getNamespaceForURI(java.lang.String uri)Returns the  Namespacewhich is mapped to the given URI or
 null if it could not be found. | 
| Element | getParent()getParentreturns the parentElementif
 this node supports the parent relationship or null if it is the root
 element or does not support the parent relationship. | 
| QName | getQName()Returns the  QNameof this element which represents the
 local name, the qualified name and theNamespace. | 
| java.lang.String | getStringValue()Returns the XPath string-value of this node. | 
| java.lang.String | getText()
 Returns the text of this node. | 
| int | indexOf(Node node)Returns the index of the given node if it is a child node of this branch
 or -1 if the given node is not a child node. | 
| Node | node(int index)Returns the  Nodeat the specified index position. | 
| int | nodeCount()Returns the number of  Nodeinstances that this branch
 contains. | 
| java.util.Iterator<Node> | nodeIterator()Returns an iterator through the content nodes of this branch | 
| ProcessingInstruction | processingInstruction(java.lang.String target)DOCUMENT ME! | 
| java.util.List<ProcessingInstruction> | processingInstructions()Returns a list of all the processing instructions in this branch. | 
| java.util.List<ProcessingInstruction> | processingInstructions(java.lang.String target)Returns a list of the processing instructions for the given target. | 
| boolean | remove(Attribute attribute)Removes the given  Attributefrom this element. | 
| protected boolean | removeNode(Node node) | 
| boolean | removeProcessingInstruction(java.lang.String target)Removes the processing instruction for the given target if it exists | 
| protected void | setAttributeList(java.util.List<Attribute> attributeList) | 
| void | setAttributes(java.util.List<Attribute> attributes)Sets the attributes that this element contains | 
| void | setContent(java.util.List<Node> content)Sets the contents of this branch as a  ListofNodeinstances. | 
| void | setDocument(Document document)setDocumentsets 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)setParentsets 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 the  QNameof this element which represents the local
 name, the qualified name and theNamespace. | 
| boolean | supportsParent()supportsParentreturns true if this node supports the
 parent relationship. | 
accept, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, addNamespace, addNewNode, addNode, addNode, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attributeValue, attributeValue, attributeValue, attributeValue, createAttributeList, createAttributeList, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getData, getName, getNamespace, getNamespacePrefix, getNamespacesForURI, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, childAdded, childRemoved, isRootElement, isTextOnly, normalize, remove, remove, remove, remove, remove, remove, remove, remove, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, toString, writeaddElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructionsasXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOfequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTextTrimaddElement, addElement, appendContent, content, elementByID, setProcessingInstructionsasXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOfpublic DefaultElement(java.lang.String name)
public DefaultElement(QName qname)
public DefaultElement(QName qname, int attributeCount)
public DefaultElement(java.lang.String name,
                      Namespace namespace)
public Element getParent()
Node
 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.
 
getParent in interface NodegetParent in class AbstractNodepublic void setParent(Element parent)
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.
 
setParent in interface NodesetParent in class AbstractNodeparent - is the new parent of this node.public Document getDocument()
Node
 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.
 
getDocument in interface NodegetDocument in class AbstractNodeDocumentpublic void setDocument(Document document)
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.
 
setDocument in interface NodesetDocument in class AbstractNodedocument - is the new document of this node.public boolean supportsParent()
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.
supportsParent in interface NodesupportsParent in class AbstractNodepublic QName getQName()
ElementQName of this element which represents the
 local name, the qualified name and the Namespace.QName associated with this elementpublic void setQName(QName name)
ElementQName of this element which represents the local
 name, the qualified name and the Namespace.name - is the QName to be associated with this elementpublic java.lang.String getText()
NodeReturns the text of this node.
public java.lang.String getStringValue()
NodegetStringValue in interface ElementgetStringValue in interface NodegetStringValue in class AbstractElementpublic java.lang.Object clone()
Node
 clone will return a deep clone or if this node is
 read-only then clone will return the same instance.
 
clone in interface Nodeclone in class AbstractNodepublic Namespace getNamespaceForPrefix(java.lang.String prefix)
ElementNamespace which is mapped to the given prefix
 or null if it could not be found.getNamespaceForPrefix in interface ElementgetNamespaceForPrefix in class AbstractElementprefix - DOCUMENT ME!Namespace associated with the given prefixpublic Namespace getNamespaceForURI(java.lang.String uri)
ElementNamespace which is mapped to the given URI or
 null if it could not be found. If there is more than one
 Namespace mapped to the URI, which of them will be
 returned is undetermined.getNamespaceForURI in interface ElementgetNamespaceForURI in class AbstractElementuri - DOCUMENT ME!Namespace associated with the given URIpublic java.util.List<Namespace> declaredNamespaces()
ElementdeclaredNamespaces in interface ElementdeclaredNamespaces in class AbstractElementpublic java.util.List<Namespace> additionalNamespaces()
ElementElement.getNamespace()method. If no
 additional namespace declarations are present for this element then an
 empty list will be returned. The list is backed by the element such that
 changes to the list will be reflected in the element though the reverse
 is not the case.additionalNamespaces in interface ElementadditionalNamespaces in class AbstractElementpublic java.util.List<Namespace> additionalNamespaces(java.lang.String defaultNamespaceURI)
additionalNamespaces in class AbstractElementpublic java.util.List<ProcessingInstruction> processingInstructions()
BranchprocessingInstructions in interface BranchprocessingInstructions in class AbstractElementpublic java.util.List<ProcessingInstruction> processingInstructions(java.lang.String target)
BranchprocessingInstructions in interface BranchprocessingInstructions in class AbstractElementtarget - DOCUMENT ME!public ProcessingInstruction processingInstruction(java.lang.String target)
BranchprocessingInstruction in interface BranchprocessingInstruction in class AbstractElementtarget - DOCUMENT ME!public boolean removeProcessingInstruction(java.lang.String target)
BranchremoveProcessingInstruction in interface BranchremoveProcessingInstruction in class AbstractElementtarget - DOCUMENT ME!public Element element(java.lang.String name)
Elementelement in interface Elementelement in class AbstractElementname - DOCUMENT ME!public Element element(QName qName)
Elementelement in interface Elementelement in class AbstractElementqName - is the fully qualified name to search forpublic Element element(java.lang.String name, Namespace namespace)
element in class AbstractElementpublic void setContent(java.util.List<Node> content)
BranchList of
 Node instances.content - is the list of nodes to use as the content for this branch.public void clearContent()
BranchNode
 instances this branch may contain.public Node node(int index)
BranchNode at the specified index position.node in interface Branchnode in class AbstractElementindex - the index of the node to return.Node at the specified position.public int indexOf(Node node)
BranchindexOf in interface BranchindexOf in class AbstractElementnode - the content child node to find.public int nodeCount()
BranchNode instances that this branch
 contains.nodeCount in interface BranchnodeCount in class AbstractElementpublic java.util.Iterator<Node> nodeIterator()
BranchnodeIterator in interface BranchnodeIterator in class AbstractElementpublic java.util.List<Attribute> attributes()
ElementAttributeinstances this element contains as a backed
 Listso that the attributes may be modified directly using the
 Listinterface. The List is backed by the
 Element so that changes to the list are reflected in the
 element and vice versa.attributes in interface Elementattributes in class AbstractElementListpublic void setAttributes(java.util.List<Attribute> attributes)
Elementattributes - DOCUMENT ME!public java.util.Iterator<Attribute> attributeIterator()
ElementattributeIterator in interface ElementattributeIterator in class AbstractElementpublic Attribute attribute(int index)
Elementattribute in interface Elementattribute in class AbstractElementindex - DOCUMENT ME!public int attributeCount()
ElementattributeCount in interface ElementattributeCount in class AbstractElementpublic Attribute attribute(java.lang.String name)
Elementattribute in interface Elementattribute in class AbstractElementname - DOCUMENT ME!public Attribute attribute(QName qName)
Elementattribute in interface Elementattribute in class AbstractElementqName - is the fully qualified namepublic Attribute attribute(java.lang.String name, Namespace namespace)
attribute in class AbstractElementpublic void add(Attribute attribute)
ElementAttribute to this element. If the given
 node already has a parent defined then an
 IllegalAddException will be thrown. Attributes with null
 values are silently ignored.
 If the value of the attribute is null then this method call will remove
 any attributes with the QName of this attribute.add in interface Elementadd in class AbstractElementattribute - is the attribute to be addedpublic boolean remove(Attribute attribute)
ElementAttribute from this element.remove in interface Elementremove in class AbstractElementattribute - is the attribute to be removedprotected void addNewNode(Node node)
AbstractElementaddNewNode in class AbstractElementnode - DOCUMENT ME!protected boolean removeNode(Node node)
removeNode in class AbstractElementprotected java.util.List<Node> contentList()
AbstractBranchcontentList in class AbstractBranchprotected java.util.List<Attribute> attributeList()
AbstractElementattributeList in class AbstractElementprotected java.util.List<Attribute> attributeList(int size)
AbstractElementattributeList in class AbstractElementsize - DOCUMENT ME!protected void setAttributeList(java.util.List<Attribute> attributeList)
protected DocumentFactory getDocumentFactory()
getDocumentFactory in class AbstractElement