DefaultElement is the default DOM4J default implementation of
an XML element.
| Modifier and Type | Field and Description |
|---|---|
| private Object | attributes
Lazily constructes list of attributes |
| private Object | content
Stores null for no content, a Node for a single content node or a List for multiple content nodes. |
| private static final transient DocumentFactory | DOCUMENT_FACTORY
Hides org. DocumentFactory instance used by default
|
| 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 |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(Attribute
is the attribute to be added attribute)Overrides org. Implements org. Attribute to this element.
|
| public List | additionalNamespaces()
Overrides org. Implements org. getNamespace()method.
|
| public List | additionalNamespaces(String defaultNamespaceURI)
Overrides org. |
| protected void | addNewNode(Node
DOCUMENT ME! node)Overrides org. |
| public Attribute | attribute(int
DOCUMENT ME! index)Overrides org. Implements org. |
| public Attribute | attribute(String
DOCUMENT ME! name)Overrides org. Implements org. |
| public Attribute | attribute(QName
is the fully qualified name qName)Overrides org. Implements org. |
| public Attribute | |
| public int | attributeCount()
Overrides org. Implements org. |
| public Iterator | attributeIterator()
Overrides org. Implements org. |
| protected List | |
| protected List | attributeList(int
DOCUMENT ME! size)Implements abstract org. |
| public List | attributes()
Overrides org. Implements org. Attributeinstances this element contains as a backed
Listso that the attributes may be modified directly using the
Listinterface.
|
| public void | clearContent()
Implements org. Node
instances this branch may contain.
|
| public Object | clone()
Overrides org. Implements org.
|
| protected List | |
| public List | declaredNamespaces()
Overrides org. Implements org. |
| public Element | element(String
DOCUMENT ME! name)Overrides org. Implements org. |
| public Element | element(QName
is the fully qualified name to search for qName)Overrides org. Implements org. |
| public Element | |
| public Document | getDocument()
Overrides org. Implements org.
|
| protected DocumentFactory | |
| public Namespace | getNamespaceForPrefix(String
DOCUMENT ME! prefix)Overrides org. Implements org. Namespace which is mapped to the given prefix
or null if it could not be found.
|
| public Namespace | getNamespaceForURI(String
DOCUMENT ME! uri)Overrides org. Implements org. Namespace which is mapped to the given URI or
null if it could not be found.
|
| public Element | getParent()
Overrides org. Implements org.
|
| public QName | getQName()
Implements org. QName of this element which represents the
local name, the qualified name and the Namespace.
|
| public String | getStringValue()
Overrides org. Implements org. |
| public String | getText()
Overrides org. Implements org. |
| public int | indexOf(Node
the content child node to find. node)Overrides org. Implements org. |
| public Node | node(int
the index of the node to return. index)Overrides org. Implements org. Node at the specified index position.
|
| public int | nodeCount()
Overrides org. Implements org. Node instances that this branch
contains.
|
| public Iterator | nodeIterator()
Overrides org. Implements org. |
| public ProcessingInstruction | processingInstruction(String
DOCUMENT ME! target)Overrides org. Implements org. |
| public List | processingInstructions()
Overrides org. Implements org. |
| public List | processingInstructions(String
DOCUMENT ME! target)Overrides org. Implements org. |
| public boolean | remove(Attribute
is the attribute to be removed attribute)Overrides org. Implements org. Attribute from this element.
|
| protected boolean | |
| public boolean | removeProcessingInstruction(String
DOCUMENT ME! target)Overrides org. Implements org. |
| protected void | |
| public void | setAttributes(List<Attribute>
DOCUMENT ME! attributes)Implements org. |
| public void | setContent(List<Node>
is the list of nodes to use as the content for this branch. content)Implements org. List of
Node instances.
|
| public void | setDocument(Document
is the new document of this node. document)Overrides org. Implements org.
|
| public void | setParent(Element
is the new parent of this node. parent)Overrides org. Implements org.
|
| public void | setQName(QName
is the name)QName to be associated with this elementImplements org. QName of this element which represents the local
name, the qualified name and the Namespace.
|
| public boolean | supportsParent()
Overrides org. Implements org.
|
| attributes | back to summary |
|---|---|
| private Object attributes Lazily constructes list of attributes | |
| content | back to summary |
|---|---|
| private Object content Stores null for no content, a Node for a single content node or a List for multiple content nodes. The List will be lazily constructed when required. | |
| DOCUMENT_FACTORY | back to summary |
|---|---|
| private static final transient DocumentFactory DOCUMENT_FACTORY Hides org. The | |
| parentBranch | back 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. | |
| qname | back to summary |
|---|---|
| private QName qname The | |
| DefaultElement | back to summary |
|---|---|
| public DefaultElement(String name) | |
| DefaultElement | back to summary |
|---|---|
| public DefaultElement(QName qname) | |
| DefaultElement | back to summary |
|---|---|
| public DefaultElement(QName qname, int attributeCount) | |
| DefaultElement | back to summary |
|---|---|
| public DefaultElement(String name, Namespace namespace) | |
| add | back to summary |
|---|---|
| public void add(Attribute attribute) Overrides org. Implements org. Doc from org. Adds the given
| |
| additionalNamespaces | back to summary |
|---|---|
| public List Overrides org. Implements org. Doc from org. Returns any additional namespaces declarations for this element other
than namespace returned via the | |
| additionalNamespaces | back to summary |
|---|---|
| public List Overrides org. | |
| addNewNode | back to summary |
|---|---|
| protected void addNewNode(Node node) Overrides org. Doc from org. Like addNode() but does not require a parent check
| |
| attribute | back to summary |
|---|---|
| public Attribute attribute(int index) Overrides org. Implements org. Doc from org. Returns the attribute at the specified indexGets the
| |
| attribute | back to summary |
|---|---|
| public Attribute attribute(String name) Overrides org. Implements org. Doc from org. Returns the attribute with the given name | |
| attribute | back to summary |
|---|---|
| public Attribute attribute(QName qName) Overrides org. Implements org. Doc from org. DOCUMENT ME! | |
| attribute | back to summary |
|---|---|
| public Attribute attribute(String name, Namespace namespace) Overrides org. | |
| attributeCount | back to summary |
|---|---|
| public int attributeCount() Overrides org. Implements org. Doc from org. DOCUMENT ME!
| |
| attributeIterator | back to summary |
|---|---|
| public Iterator Overrides org. Implements org. Doc from org. DOCUMENT ME! | |
| attributeList | back to summary |
|---|---|
| protected List Implements abstract org. Doc from org. DOCUMENT ME! | |
| attributeList | back to summary |
|---|---|
| protected List Implements abstract org. Doc from org. DOCUMENT ME! | |
| attributes | back to summary |
|---|---|
| public List Overrides org. Implements org. Doc from org. Returns the | |
| clearContent | back to summary |
|---|---|
| public void clearContent() Implements org. Doc from org. Clears the content for this branch, removing any | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides org. Implements org. Doc from org.
| |
| contentList | back to summary |
|---|---|
| protected List Implements abstract org. Doc from org. DOCUMENT ME! | |
| declaredNamespaces | back to summary |
|---|---|
| public List Overrides org. Implements org. Doc from org. Returns all the namespaces declared by this element. If no namespaces are declared 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. | |
| element | back to summary |
|---|---|
| public Element element(String name) Overrides org. Implements org. Doc from org. Returns the first element for the given local name and any namespace. | |
| element | back to summary |
|---|---|
| public Element element(QName qName) Overrides org. Implements org. Doc from org. Returns the first element for the given fully qualified name. | |
| element | back to summary |
|---|---|
| public Element element(String name, Namespace namespace) Overrides org. | |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Overrides org. Implements org. Doc from org.
This method is an optional feature and may not be supported for all
| |
| getDocumentFactory | back to summary |
|---|---|
| protected DocumentFactory getDocumentFactory() Overrides org. | |
| getNamespaceForPrefix | back to summary |
|---|---|
| public Namespace getNamespaceForPrefix(String prefix) Overrides org. Implements org. Doc from org. Returns the | |
| getNamespaceForURI | back to summary |
|---|---|
| public Namespace getNamespaceForURI(String uri) Overrides org. Implements org. Doc from org. Returns the | |
| getParent | back to summary |
|---|---|
| public Element getParent() Overrides org. Implements org. Doc from org.
This method is an optional feature and may not be supported for all
| |
| getQName | back to summary |
|---|---|
| public QName getQName() Implements org. Doc from org. Returns the
| |
| getStringValue | back to summary |
|---|---|
| public String getStringValue() Overrides org. Implements org. Doc from org. Returns the XPath string-value of this node. The behaviour of this method
is defined in the XPath
specification . This method returns the string-value of all the
contained
| |
| getText | back to summary |
|---|---|
| public String getText() Overrides org. Implements org. Doc from org. Returns the text value of this element without recursing through child
elements. This method iterates through all
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(Node node) Overrides org. Implements org. Doc from org. 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 | back to summary |
|---|---|
| public Node node(int index) Overrides org. Implements org. Doc from org. Returns the
| |
| nodeCount | back to summary |
|---|---|
| public int nodeCount() Overrides org. Implements org. Doc from org. Returns the number of
| |
| nodeIterator | back to summary |
|---|---|
| public Iterator Overrides org. Implements org. Doc from org. Returns an iterator through the content nodes of this branch | |
| processingInstruction | back to summary |
|---|---|
| public ProcessingInstruction processingInstruction(String target) Overrides org. Implements org. Doc from org. DOCUMENT ME!
| |
| processingInstructions | back to summary |
|---|---|
| public List Overrides org. Implements org. Doc from org. Returns a list of all the processing instructions in this branch. The list is backed by this branch so that changes to the list will be reflected in the branch but the reverse is not the case.
| |
| processingInstructions | back to summary |
|---|---|
| public List Overrides org. Implements org. Doc from org. Returns a list of the processing instructions for the given target. The list is backed by this branch so that changes to the list will be reflected in the branch but the reverse is not the case.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Attribute attribute) Overrides org. Implements org. Doc from org. Removes the given
| |
| removeNode | back to summary |
|---|---|
| protected boolean removeNode(Node node) Overrides org. | |
| removeProcessingInstruction | back to summary |
|---|---|
| public boolean removeProcessingInstruction(String target) Overrides org. Implements org. Doc from org. Removes the processing instruction for the given target if it exists
| |
| setAttributeList | back to summary |
|---|---|
| protected void setAttributeList(List<Attribute> attributeList) | |
| setAttributes | back to summary |
|---|---|
| public void setAttributes(List<Attribute> attributes) Implements org. Doc from org. Sets the attributes that this element contains | |
| setContent | back to summary |
|---|---|
| public void setContent(List<Node> content) Implements org. Doc from org. Sets the contents of this branch as a | |
| setDocument | back to summary |
|---|---|
| public void setDocument(Document document) Overrides org. Implements org. Doc from org.
This method should only be called from inside a
| |
| setParent | back to summary |
|---|---|
| public void setParent(Element parent) Overrides org. Implements org. Doc from org.
This method should only be called from inside an
| |
| setQName | back to summary |
|---|---|
| public void setQName(QName name) Implements org. Doc from org. Sets the
| |
| supportsParent | back to summary |
|---|---|
| public boolean supportsParent() Overrides org. Implements org. Doc from org.
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.
| |