BaseElement, DefaultElementpublic abstract class AbstractElement extends AbstractBranch implements Element
AbstractElement is an abstract base class for tree
implementors to use for implementation inheritence.
| Modifier and Type | Field | Description |
|---|---|---|
protected static boolean |
USE_STRINGVALUE_SEPARATOR |
|
protected static boolean |
VERBOSE_TOSTRING |
DEFAULT_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 | Description |
|---|---|
AbstractElement() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
accept(Visitor visitor) |
accept method is the Visitor Pattern
method. |
void |
add(Attribute attribute) |
Adds the given
Attribute to this element. |
void |
add(CDATA cdata) |
Adds the given
CDATA to this element. |
void |
add(Comment comment) |
Adds the given
Comment to this branch. |
void |
add(Element element) |
Adds the given
Element to this branch. |
void |
add(Entity entity) |
Adds the given
Entity to this element. |
void |
add(Namespace namespace) |
Adds the given
Namespace to this element. |
void |
add(Node node) |
Adds the given
Node or throws IllegalAddException
if the given node is not of a valid type. |
void |
add(ProcessingInstruction pi) |
Adds the given
ProcessingInstruction to this branch. |
void |
add(Text text) |
Adds the given
Text to this element. |
Element |
addAttribute(java.lang.String name,
java.lang.String value) |
Adds the attribute value of the given local name.
|
Element |
addAttribute(QName qName,
java.lang.String value) |
Adds the attribute value of the given fully qualified name.
|
Element |
addCDATA(java.lang.String cdata) |
Adds a new
CDATA node with the given text to this element. |
Element |
addComment(java.lang.String comment) |
Adds a new
Comment node with the given text to this
element. |
Element |
addElement(java.lang.String name) |
Adds a new
Element node with the given name to this branch
and returns a reference to the new node. |
Element |
addEntity(java.lang.String name,
java.lang.String text) |
Adds a new
Entity node with the given name and text to
this element and returns a reference to the new node. |
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) |
|
Element |
addNamespace(java.lang.String prefix,
java.lang.String uri) |
Adds a namespace to this element for use by its child content
|
protected void |
addNewNode(int index,
Node node) |
|
protected void |
addNewNode(Node node) |
Like addNode() but does not require a parent check
|
protected void |
addNode(int index,
Node node) |
|
protected void |
addNode(Node node) |
|
Element |
addProcessingInstruction(java.lang.String target,
java.lang.String data) |
Adds a processing instruction for the given target
|
Element |
addProcessingInstruction(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String> data) |
Adds a processing instruction for the given target
|
Element |
addText(java.lang.String text) |
Adds a new
Text node with the given text to this element. |
void |
appendAttributes(Element element) |
Appends the attributes of the given element to me.
|
java.lang.String |
asXML() |
asXML returns the textual XML representation of this node. |
Attribute |
attribute(int index) |
Returns the attribute at the specified indexGets the
|
Attribute |
attribute(java.lang.String name) |
Returns the attribute with the given name
|
Attribute |
attribute(java.lang.String name,
Namespace namespace) |
|
Attribute |
attribute(QName qName) |
DOCUMENT ME!
|
int |
attributeCount() |
DOCUMENT ME!
|
java.util.Iterator<Attribute> |
attributeIterator() |
DOCUMENT ME!
|
protected abstract java.util.List<Attribute> |
attributeList() |
DOCUMENT ME!
|
protected abstract java.util.List<Attribute> |
attributeList(int attributeCount) |
DOCUMENT ME!
|
java.util.List<Attribute> |
attributes() |
Returns the
Attributeinstances this element contains as a backed
Listso that the attributes may be modified directly using the
Listinterface. |
java.lang.String |
attributeValue(java.lang.String name) |
This returns the attribute value for the attribute with the given name
and any namespace or null if there is no such attribute or the empty
string if the attribute value is empty.
|
java.lang.String |
attributeValue(java.lang.String name,
java.lang.String defaultValue) |
This returns the attribute value for the attribute with the given name
and any namespace or the default value if there is no such attribute
value.
|
java.lang.String |
attributeValue(QName qName) |
This returns the attribute value for the attribute with the given fully
qualified name or null if there is no such attribute or the empty string
if the attribute value is empty.
|
java.lang.String |
attributeValue(QName qName,
java.lang.String defaultValue) |
This returns the attribute value for the attribute with the given fully
qualified name or the default value if there is no such attribute value.
|
protected java.util.List<Attribute> |
createAttributeList() |
A Factory Method pattern which creates a List implementation used to
store attributes
|
protected java.util.List<Attribute> |
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(java.lang.String name) |
Creates a deep copy of this element with the given local name The new
element is detached from its parent, and getParent() on the clone will
return null.
|
Element |
createCopy(QName qName) |
Creates a deep copy of this element with the given fully qualified name.
|
protected Element |
createElement(java.lang.String name) |
|
protected Element |
createElement(QName qName) |
|
protected <T> java.util.Iterator<T> |
createSingleIterator(T result) |
|
java.util.List<Namespace> |
declaredNamespaces() |
Returns all the namespaces declared by this element.
|
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) |
|
Element |
element(QName qName) |
Returns the first element for the given fully qualified name.
|
java.util.Iterator<Element> |
elementIterator() |
Returns an iterator over all this elements child elements.
|
java.util.Iterator<Element> |
elementIterator(java.lang.String name) |
Returns an iterator over the elements contained in this element which
match the given local name and any namespace.
|
java.util.Iterator<Element> |
elementIterator(java.lang.String name,
Namespace ns) |
|
java.util.Iterator<Element> |
elementIterator(QName qName) |
Returns an iterator over the elements contained in this element which
match the given fully qualified name.
|
java.util.List<Element> |
elements() |
Returns the elements contained in this element.
|
java.util.List<Element> |
elements(java.lang.String name) |
Returns the elements contained in this element with the given local name
and any namespace.
|
java.util.List<Element> |
elements(java.lang.String name,
Namespace namespace) |
|
java.util.List<Element> |
elements(QName qName) |
Returns the elements contained in this element with the given fully
qualified name.
|
java.lang.String |
elementText(java.lang.String name) |
|
java.lang.String |
elementText(QName qName) |
|
java.lang.String |
elementTextTrim(java.lang.String name) |
|
java.lang.String |
elementTextTrim(QName qName) |
|
void |
ensureAttributesCapacity(int minCapacity) |
Ensures that the list of attributes has the given size
|
java.lang.Object |
getData() |
Accesses the data of this element which may implement data typing
bindings such as XML Schema or Java Bean bindings or will return the same
value as
Element.getText() |
protected DocumentFactory |
getDocumentFactory() |
|
java.lang.String |
getName() |
getName returns the name of this node. |
Namespace |
getNamespace() |
Returns the
Namespace of this element if one exists
otherwise Namespace.NO_NAMESPACE is returned. |
Namespace |
getNamespaceForPrefix(java.lang.String prefix) |
Returns the
Namespace which is mapped to the given prefix
or null if it could not be found. |
Namespace |
getNamespaceForURI(java.lang.String uri) |
Returns the
Namespace which is mapped to the given URI or
null if it could not be found. |
java.lang.String |
getNamespacePrefix() |
Returns the namespace prefix of this element if one exists otherwise an
empty
String is returned. |
java.util.List<Namespace> |
getNamespacesForURI(java.lang.String uri) |
Returns the all namespaces which are mapped to the given URI or an empty
list if no such namespaces could be found.
|
java.lang.String |
getNamespaceURI() |
Returns the URI mapped to the namespace of this element if one exists
otherwise an empty
String is returned. |
short |
getNodeType() |
Returns the code according to the type of node.
|
java.lang.String |
getPath(Element context) |
Returns the relative XPath expression which will return a node set
containing the given node such as a/b/@c.
|
QName |
getQName(java.lang.String qualifiedName) |
Returns the
QName for the given qualified name, using the
namespace URI in scope for the given prefix of the qualified name or the
default namespace if the qualified name has no prefix. |
java.lang.String |
getQualifiedName() |
Returns the fully qualified name of this element.
|
java.lang.String |
getStringValue() |
Returns the XPath string-value of this node.
|
java.lang.String |
getUniquePath(Element context) |
Returns the relative unique XPath expression from the given context which
will return a nodeset of one node which is the current node.
|
java.lang.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) |
Returns a node at the given index suitable for an XPath result set.
|
boolean |
hasMixedContent() |
Returns true if this
Element has mixed content. |
protected void |
childAdded(Node node) |
Called when a new child node is added to create any parent relationships
|
protected void |
childRemoved(Node node) |
Called when a child node has been removed to allow any parent
relationships to be deleted or events to be fired.
|
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.
|
boolean |
isRootElement() |
DOCUMENT ME!
|
boolean |
isTextOnly() |
Returns true if this
Element has text only content. |
Node |
node(int index) |
Returns the
Node at the specified index position. |
int |
nodeCount() |
Returns the number of
Node instances that this branch
contains. |
java.util.Iterator<Node> |
nodeIterator() |
Returns an iterator through the content nodes of this branch
|
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(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
Attribute from this element. |
boolean |
remove(CDATA cdata) |
Removes the given
CDATA if the node is an immediate child
of this element. |
boolean |
remove(Comment comment) |
Removes the given
Comment if the node is an immediate
child of this branch. |
boolean |
remove(Element element) |
Removes the given
Element if the node is an immediate
child of this branch. |
boolean |
remove(Entity entity) |
Removes the given
Entity if the node is an immediate child
of this element. |
boolean |
remove(Namespace namespace) |
Removes the given
Namespace if the node is an immediate
child of this element. |
boolean |
remove(Node node) |
Removes the given
Node if the node is an immediate child
of this branch. |
boolean |
remove(ProcessingInstruction pi) |
Removes the given
ProcessingInstruction if the node is an
immediate child of this branch. |
boolean |
remove(Text text) |
Removes the given
Text if the node is an immediate child
of this element. |
protected boolean |
removeNode(Node node) |
|
boolean |
removeProcessingInstruction(java.lang.String target) |
Removes the processing instruction for the given target if it exists
|
void |
setAttributes(org.xml.sax.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(java.lang.String name,
java.lang.String value) |
Deprecated.
As of version 0.5. Please use
addAttribute(String, String) instead. WILL BE REMOVED IN
dom4j-1.6 !! |
void |
setAttributeValue(QName qName,
java.lang.String value) |
Deprecated.
As of version 0.5. Please use
addAttribute(String, String) instead. WILL BE REMOVED IN
dom4j-1.6 !! |
void |
setData(java.lang.Object data) |
Sets the data value of this element if this element supports data binding
or calls
Node.setText(java.lang.String)if it doesn't |
void |
setName(java.lang.String name) |
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only. |
void |
setNamespace(Namespace namespace) |
|
void |
setText(java.lang.String text) |
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only. |
java.lang.String |
toString() |
|
void |
write(java.io.Writer out) |
write writes this node as the default XML notation for
this node. |
addElement, addElement, addElement, appendContent, content, contentList, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructionsasXPathResult, clone, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getDocument, getNodeTypeName, getParent, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, supportsParent, valueOfaddElement, addElement, appendContent, clearContent, content, elementByID, setContent, setProcessingInstructionsgetQName, getText, getTextTrim, setAttributes, setQNameasXPathResult, clone, createXPath, detach, getDocument, getNodeTypeName, getParent, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, supportsParent, valueOfprotected static final boolean VERBOSE_TOSTRING
protected static final boolean USE_STRINGVALUE_SEPARATOR
public short getNodeType()
NodegetNodeType in interface NodegetNodeType in class AbstractNodepublic boolean isRootElement()
ElementisRootElement in interface Elementpublic void setName(java.lang.String name)
Node
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only.
setName in interface NodesetName in class AbstractNodename - is the new name of this nodepublic void setNamespace(Namespace namespace)
public java.lang.String getXPathNameStep()
public java.lang.String getPath(Element context)
NodegetPath in interface Nodecontext - is the parent context from which the relative path should
start. If the context is null or the context is not an
ancestor of this node then the path will be absolute and start
from the document and so begin with the '/' character.public java.lang.String getUniquePath(Element context)
NodeReturns the relative unique XPath expression from the given context which will return a nodeset of one node which is the current node. This method will use the XPath index operator to restrict the path if multiple elements with the same name occur on the path.
getUniquePath in interface Nodecontext - is the parent context from which the path should start. If the
context is null or the context is not an ancestor of this node
then the path will start from the document and so begin with
the '/' character.public java.lang.String asXML()
Node
asXML returns the textual XML representation of this node.
public void write(java.io.Writer out)
throws java.io.IOException
Node
write writes this node as the default XML notation for
this node. If you wish to control the XML output (such as for pretty
printing, changing the indentation policy etc.) then please use XMLWriter or its derivations.
write in interface Nodewrite in class AbstractNodeout - is the Writer to output the XML tojava.io.IOException - DOCUMENT ME!public void accept(Visitor visitor)
accept method is the Visitor Pattern
method.
public java.lang.String toString()
toString in class java.lang.Objectpublic Namespace getNamespace()
ElementNamespace of this element if one exists
otherwise Namespace.NO_NAMESPACE is returned.getNamespace in interface ElementNamespace associated with this elementpublic java.lang.String getName()
Node
getName returns the name of this node. This is the XML
local name of the element, attribute, entity or processing instruction.
For CDATA and Text nodes this method will return null.
getName in interface NodegetName in class AbstractNodepublic java.lang.String getNamespacePrefix()
ElementString is returned.getNamespacePrefix in interface ElementNamespace of this element or an
empty Stringpublic java.lang.String getNamespaceURI()
ElementString is returned.getNamespaceURI in interface ElementNamespace of this element or an
empty Stringpublic java.lang.String getQualifiedName()
ElementNode.getName()if this element has no
namespace attached to this element or an expression of the form
getNamespacePrefix() + ":" + getName()will be returned.
getQualifiedName in interface Elementpublic java.lang.Object getData()
ElementElement.getText()public void setData(java.lang.Object data)
ElementNode.setText(java.lang.String)if it doesn'tpublic Node node(int index)
BranchNode at the specified index position.node in interface Branchnode in class AbstractBranchindex - the index of the node to return.Node at the specified position.public int indexOf(Node node)
BranchindexOf in interface BranchindexOf in class AbstractBranchnode - the content child node to find.public int nodeCount()
BranchNode instances that this branch
contains.nodeCount in interface BranchnodeCount in class AbstractBranchpublic java.util.Iterator<Node> nodeIterator()
BranchnodeIterator in interface BranchnodeIterator in class AbstractBranchpublic Element element(java.lang.String name)
Elementpublic Element element(QName qName)
Elementpublic java.util.List<Element> elements()
Elementpublic java.util.List<Element> elements(java.lang.String name)
Elementpublic java.util.List<Element> elements(QName qName)
Elementpublic java.util.Iterator<Element> elementIterator()
ElementelementIterator in interface Elementpublic java.util.Iterator<Element> elementIterator(java.lang.String name)
ElementelementIterator in interface Elementname - DOCUMENT ME!public java.util.Iterator<Element> elementIterator(QName qName)
ElementelementIterator in interface ElementqName - is the fully qualified name to search forpublic java.util.Iterator<Element> elementIterator(java.lang.String name, Namespace ns)
public 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 ElementListpublic java.util.Iterator<Attribute> attributeIterator()
ElementattributeIterator in interface Elementpublic Attribute attribute(int index)
Elementpublic int attributeCount()
ElementattributeCount in interface Elementpublic Attribute attribute(java.lang.String name)
Elementpublic Attribute attribute(QName qName)
Elementpublic void setAttributes(org.xml.sax.Attributes attributes,
NamespaceStack namespaceStack,
boolean noNamespaceAttributes)
SAXReader.attributes - DOCUMENT ME!namespaceStack - DOCUMENT ME!noNamespaceAttributes - DOCUMENT ME!public java.lang.String attributeValue(java.lang.String name)
ElementattributeValue in interface Elementname - is the name of the attribute value to be returnedpublic java.lang.String attributeValue(QName qName)
ElementattributeValue in interface ElementqName - is the fully qualified namepublic java.lang.String attributeValue(java.lang.String name,
java.lang.String defaultValue)
ElementattributeValue in interface Elementname - is the name of the attribute value to be returneddefaultValue - is the default value to be returned if the attribute has no
value defined.public java.lang.String attributeValue(QName qName, java.lang.String defaultValue)
ElementattributeValue in interface ElementqName - is the fully qualified namedefaultValue - is the default value to be returned if the attribute has no
value defined.public void setAttributeValue(java.lang.String name,
java.lang.String value)
addAttribute(String, String) instead. WILL BE REMOVED IN
dom4j-1.6 !!setAttributeValue in interface Elementname - DOCUMENT ME!value - DOCUMENT ME!public void setAttributeValue(QName qName, java.lang.String value)
addAttribute(String, String) instead. WILL BE REMOVED IN
dom4j-1.6 !!setAttributeValue in interface ElementqName - DOCUMENT ME!value - DOCUMENT ME!public 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.public boolean remove(Attribute attribute)
ElementAttribute from this element.public java.util.List<ProcessingInstruction> processingInstructions()
BranchprocessingInstructions in interface Branchpublic java.util.List<ProcessingInstruction> processingInstructions(java.lang.String target)
BranchprocessingInstructions in interface Branchtarget - DOCUMENT ME!public ProcessingInstruction processingInstruction(java.lang.String target)
BranchprocessingInstruction in interface Branchtarget - DOCUMENT ME!public boolean removeProcessingInstruction(java.lang.String target)
BranchremoveProcessingInstruction in interface Branchtarget - DOCUMENT ME!public Node getXPathResult(int index)
ElementgetXPathResult in interface Elementindex - DOCUMENT ME!public Element addAttribute(java.lang.String name, java.lang.String value)
ElementaddAttribute in interface Elementname - is the name of the attribute whose value is to be added or
updatedvalue - is the attribute's valueElement instance.public Element addAttribute(QName qName, java.lang.String value)
ElementaddAttribute in interface ElementqName - is the fully qualified name of the attribute whose value is to
be added or updatedvalue - is the attribute's valueElement instance.public Element addCDATA(java.lang.String cdata)
ElementCDATA node with the given text to this element.public Element addComment(java.lang.String comment)
ElementComment node with the given text to this
element.addComment in interface Elementcomment - is the text for the Comment node.Element instance.public Element addElement(java.lang.String name)
BranchElement node with the given name to this branch
and returns a reference to the new node.addElement in interface BranchaddElement in class AbstractBranchname - is the name for the Element node.Element node.public Element addEntity(java.lang.String name, java.lang.String text)
ElementEntity node with the given name and text to
this element and returns a reference to the new node.public Element addNamespace(java.lang.String prefix, java.lang.String uri)
ElementaddNamespace in interface Elementprefix - is the prefix to use, which should not be null or blankuri - is the namespace URIElement instance.public Element addProcessingInstruction(java.lang.String target, java.lang.String data)
ElementaddProcessingInstruction in interface Elementtarget - is the target of the processing instructiondata - is the textual data (key/value pairs) of the processing
instructionElement instance.public Element addProcessingInstruction(java.lang.String target, java.util.Map<java.lang.String,java.lang.String> data)
ElementaddProcessingInstruction in interface Elementtarget - is the target of the processing instructiondata - is a Map of the key / value pairs of the processing
instructionElement instance.public Element addText(java.lang.String text)
ElementText node with the given text to this element.public void add(Node node)
BranchNode or throws IllegalAddException
if the given node is not of a valid type. This is a polymorphic method
which will call the typesafe method for the node type such as
add(Element) or add(Comment).add in interface Branchadd in class AbstractBranchnode - is the given node to addpublic boolean remove(Node node)
BranchNode if the node is an immediate child
of this branch. If the given node is not an immediate child of this
branch then the Node.detach()method should be used instead. This
is a polymorphic method which will call the typesafe method for the node
type such as remove(Element) or remove(Comment).remove in interface Branchremove in class AbstractBranchnode - is the given node to be removedpublic void add(CDATA cdata)
ElementCDATA to this element. If the given node
already has a parent defined then an IllegalAddException
will be thrown.public void add(Comment comment)
BranchComment to this branch. If the given node
already has a parent defined then an IllegalAddException
will be thrown.add in interface Branchadd in class AbstractBranchcomment - is the comment to be addedpublic void add(Element element)
BranchElement to this branch. If the given node
already has a parent defined then an IllegalAddException
will be thrown.add in interface Branchadd in class AbstractBranchelement - is the element to be addedpublic void add(Entity entity)
ElementEntity to this element. If the given node
already has a parent defined then an IllegalAddException
will be thrown.public void add(Namespace namespace)
ElementNamespace to this element. If the given
node already has a parent defined then an
IllegalAddException will be thrown.public void add(ProcessingInstruction pi)
BranchProcessingInstruction to this branch. If
the given node already has a parent defined then an
IllegalAddException will be thrown.add in interface Branchadd in class AbstractBranchpi - is the processing instruction to be addedpublic void add(Text text)
ElementText to this element. If the given node
already has a parent defined then an IllegalAddException
will be thrown.public boolean remove(CDATA cdata)
ElementCDATA if the node is an immediate child
of this element. If the given node is not an immediate child of this
element then the Node.detach()method should be used instead.public boolean remove(Comment comment)
BranchComment if the node is an immediate
child of this branch. If the given node is not an immediate child of this
branch then the Node.detach()method should be used instead.remove in interface Branchremove in class AbstractBranchcomment - is the comment to be removedpublic boolean remove(Element element)
BranchElement if the node is an immediate
child of this branch. If the given node is not an immediate child of this
branch then the Node.detach()method should be used instead.remove in interface Branchremove in class AbstractBranchelement - is the element to be removedpublic boolean remove(Entity entity)
ElementEntity if the node is an immediate child
of this element. If the given node is not an immediate child of this
element then the Node.detach()method should be used instead.public boolean remove(Namespace namespace)
ElementNamespace if the node is an immediate
child of this element. If the given node is not an immediate child of
this element then the Node.detach()method should be used
instead.public boolean remove(ProcessingInstruction pi)
BranchProcessingInstruction if the node is an
immediate child of this branch. If the given node is not an immediate
child of this branch then the Node.detach()method should be used
instead.remove in interface Branchremove in class AbstractBranchpi - is the processing instruction to be removedpublic boolean remove(Text text)
ElementText if the node is an immediate child
of this element. If the given node is not an immediate child of this
element then the Node.detach()method should be used instead.public boolean hasMixedContent()
ElementElement has mixed content. Mixed
content means that an element contains both textual data and child
elements.hasMixedContent in interface Elementpublic boolean isTextOnly()
ElementElement has text only content.isTextOnly in interface Elementpublic void setText(java.lang.String text)
Node
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only.
setText in interface NodesetText in class AbstractNodetext - is the new textual value of this nodepublic java.lang.String getStringValue()
NodegetStringValue in interface ElementgetStringValue in interface NodegetStringValue in class AbstractNodepublic void normalize()
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.public java.lang.String elementText(java.lang.String name)
elementText in interface Elementpublic java.lang.String elementText(QName qName)
elementText in interface Elementpublic java.lang.String elementTextTrim(java.lang.String name)
elementTextTrim in interface Elementpublic java.lang.String elementTextTrim(QName qName)
elementTextTrim in interface Elementpublic void appendAttributes(Element element)
ElementCollection.addAll(java.util.Collection)
method.appendAttributes in interface Elementelement - is the element whose attributes will be added to me.public Element createCopy()
This returns a deep clone of this element. The new element is detached from its parent, and getParent() on the clone will return null.
createCopy in interface Elementpublic Element createCopy(java.lang.String name)
ElementcreateCopy in interface Elementname - DOCUMENT ME!public Element createCopy(QName qName)
ElementcreateCopy in interface ElementqName - DOCUMENT ME!public QName getQName(java.lang.String qualifiedName)
ElementQName for the given qualified name, using the
namespace URI in scope for the given prefix of the qualified name or the
default namespace if the qualified name has no prefix.public 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 Elementprefix - 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 Elementuri - DOCUMENT ME!Namespace associated with the given URIpublic java.util.List<Namespace> getNamespacesForURI(java.lang.String uri)
ElementgetNamespacesForURI in interface Elementuri - DOCUMENT ME!public java.util.List<Namespace> declaredNamespaces()
ElementdeclaredNamespaces in interface Elementpublic 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 Elementpublic java.util.List<Namespace> additionalNamespaces(java.lang.String defaultNamespaceURI)
public void ensureAttributesCapacity(int minCapacity)
minCapacity - DOCUMENT ME!protected Element createElement(java.lang.String name)
protected void addNode(Node node)
addNode in class AbstractBranchprotected void addNode(int index,
Node node)
addNode in class AbstractBranchprotected void addNewNode(Node node)
node - DOCUMENT ME!protected void addNewNode(int index,
Node node)
protected boolean removeNode(Node node)
removeNode in class AbstractBranchprotected void childAdded(Node node)
childAdded in class AbstractBranchnode - DOCUMENT ME!protected void childRemoved(Node node)
AbstractBranchchildRemoved in class AbstractBranchnode - DOCUMENT ME!protected abstract java.util.List<Attribute> attributeList()
protected abstract java.util.List<Attribute> attributeList(int attributeCount)
attributeCount - DOCUMENT ME!protected DocumentFactory getDocumentFactory()
getDocumentFactory in class AbstractNodeprotected java.util.List<Attribute> createAttributeList()
protected java.util.List<Attribute> createAttributeList(int size)
size - DOCUMENT ME!protected <T> java.util.Iterator<T> createSingleIterator(T result)