org.dom4j.tree
public abstract class AbstractElement extends AbstractBranch implements Element
AbstractElement
is an abstract base class for tree
implementors to use for implementation inheritence.
Version: $Revision: 1.80 $
Field Summary | |
---|---|
protected static Iterator | EMPTY_ITERATOR |
protected static List | EMPTY_LIST |
protected static boolean | USE_STRINGVALUE_SEPARATOR |
protected static boolean | VERBOSE_TOSTRING |
Constructor Summary | |
---|---|
AbstractElement() |
Method Summary | |
---|---|
void | accept(Visitor visitor)
|
void | add(Attribute attribute) |
void | add(Node node) |
void | add(CDATA cdata) |
void | add(Comment comment) |
void | add(Element element) |
void | add(Entity entity) |
void | add(Namespace namespace) |
void | add(ProcessingInstruction pi) |
void | add(Text text) |
Element | addAttribute(String name, String value) |
Element | addAttribute(QName qName, String value) |
Element | addCDATA(String cdata) |
Element | addComment(String comment) |
Element | addElement(String name) |
Element | addEntity(String name, String text) |
List | additionalNamespaces() |
List | additionalNamespaces(String defaultNamespaceURI) |
Element | addNamespace(String prefix, String uri) |
protected void | addNewNode(Node node)
Like addNode() but does not require a parent check
|
protected void | addNewNode(int index, Node node) |
protected void | addNode(Node node) |
protected void | addNode(int index, Node node) |
Element | addProcessingInstruction(String target, String data) |
Element | addProcessingInstruction(String target, Map data) |
Element | addText(String text) |
void | appendAttributes(Element element) |
String | asXML() |
Attribute | attribute(int index) |
Attribute | attribute(String name) |
Attribute | attribute(QName qName) |
Attribute | attribute(String name, Namespace namespace) |
int | attributeCount() |
Iterator | attributeIterator() |
protected abstract List | attributeList()
DOCUMENT ME!
|
protected abstract List | attributeList(int attributeCount)
DOCUMENT ME!
|
List | attributes() |
String | attributeValue(String name) |
String | attributeValue(QName qName) |
String | attributeValue(String name, String defaultValue) |
String | attributeValue(QName qName, String defaultValue) |
protected void | childAdded(Node node)
Called when a new child node is added to create any parent relationships
|
protected void | childRemoved(Node node) |
protected List | createAttributeList()
A Factory Method pattern which creates a List implementation used to
store attributes
|
protected List | createAttributeList(int size)
A Factory Method pattern which creates a List implementation used to
store attributes
|
Element | createCopy() This returns a deep clone of this element. |
Element | createCopy(String name) |
Element | createCopy(QName qName) |
protected Element | createElement(String name) |
protected Element | createElement(QName qName) |
protected Iterator | createSingleIterator(Object result) |
List | declaredNamespaces() |
Element | element(String name) |
Element | element(QName qName) |
Element | element(String name, Namespace namespace) |
Iterator | elementIterator() |
Iterator | elementIterator(String name) |
Iterator | elementIterator(QName qName) |
Iterator | elementIterator(String name, Namespace ns) |
List | elements() |
List | elements(String name) |
List | elements(QName qName) |
List | elements(String name, Namespace namespace) |
String | elementText(String name) |
String | elementText(QName qName) |
String | elementTextTrim(String name) |
String | elementTextTrim(QName qName) |
void | ensureAttributesCapacity(int minCapacity)
Ensures that the list of attributes has the given size
|
Object | getData() |
protected DocumentFactory | getDocumentFactory() |
String | getName() |
Namespace | getNamespace() |
Namespace | getNamespaceForPrefix(String prefix) |
Namespace | getNamespaceForURI(String uri) |
String | getNamespacePrefix() |
List | getNamespacesForURI(String uri) |
String | getNamespaceURI() |
short | getNodeType() |
String | getPath(Element context) |
QName | getQName(String qualifiedName) |
String | getQualifiedName() |
String | getStringValue() |
String | getUniquePath(Element context) |
String | getXPathNameStep()
Returns the XPath expression to match this Elements name which is
getQualifiedName() if there is a namespace prefix defined or if no
namespace is present then it is getName() or if a namespace is defined
with no prefix then the expression is [name()='X'] where X = getName().
|
Node | getXPathResult(int index) |
boolean | hasMixedContent() |
int | indexOf(Node node) |
boolean | isRootElement() |
boolean | isTextOnly() |
Node | node(int index) |
int | nodeCount() |
Iterator | nodeIterator() |
void | normalize()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
ProcessingInstruction | processingInstruction(String target) |
List | processingInstructions() |
List | processingInstructions(String target) |
boolean | remove(Attribute attribute) |
boolean | remove(Node node) |
boolean | remove(CDATA cdata) |
boolean | remove(Comment comment) |
boolean | remove(Element element) |
boolean | remove(Entity entity) |
boolean | remove(Namespace namespace) |
boolean | remove(ProcessingInstruction pi) |
boolean | remove(Text text) |
protected boolean | removeNode(Node node) |
boolean | removeProcessingInstruction(String target) |
void | setAttributes(Attributes attributes, NamespaceStack namespaceStack, boolean noNamespaceAttributes)
This method provides a more optimal way of setting all the attributes on
an Element particularly for use in SAXReader.
|
void | setAttributeValue(String name, String value)
DOCUMENT ME!
|
void | setAttributeValue(QName qName, String value)
DOCUMENT ME!
|
void | setData(Object data) |
void | setName(String name) |
void | setNamespace(Namespace namespace) |
void | setText(String text) |
String | toString() |
void | write(Writer out) |
accept
method is the Visitor Pattern
method.
Parameters: visitor
Visitor
is the visitor.
Parameters: node DOCUMENT ME!
Returns: the internal List used to store attributes or creates one if one is not available
Parameters: attributeCount DOCUMENT ME!
Returns: the internal List used to store attributes or creates one with the specified size if one is not available
Parameters: node DOCUMENT ME!
Returns: DOCUMENT ME!
Parameters: size DOCUMENT ME!
Returns: DOCUMENT ME!
This returns a deep clone of this element. The new element is detached from its parent, and getParent() on the clone will return null.
Returns: the clone of this element
Parameters: minCapacity DOCUMENT ME!
Returns: DOCUMENT ME!
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes. This can
be used to ensure that the DOM view of a document is the same as if it
were saved and re-loaded, and is useful when operations (such as XPointer
lookups) that depend on a particular document tree structure are to be
used.In cases where the document contains CDATASections
,
the normalize operation alone may not be sufficient, since XPointers do
not differentiate between Text
nodes and
CDATASection
nodes.
Since: DOM Level 2
Parameters: attributes DOCUMENT ME! namespaceStack DOCUMENT ME! noNamespaceAttributes DOCUMENT ME!
Deprecated: As of version 0.5. Please use addAttribute instead. WILL BE REMOVED IN dom4j-1.6 !!
DOCUMENT ME!Parameters: name DOCUMENT ME! value DOCUMENT ME!
Deprecated: As of version 0.5. Please use addAttribute instead. WILL BE REMOVED IN dom4j-1.6 !!
DOCUMENT ME!Parameters: qName DOCUMENT ME! value DOCUMENT ME!