Package org.dom4j.util
Class UserDataElement
- java.lang.Object
-
- org.dom4j.tree.AbstractNode
-
- org.dom4j.tree.AbstractBranch
-
- org.dom4j.tree.AbstractElement
-
- org.dom4j.tree.DefaultElement
-
- org.dom4j.util.UserDataElement
-
public class UserDataElement extends DefaultElement
UserDataElement
support the adornment of a user data object on an Element or Attribute instance such that the methodsgetData()
setData(Object)
will get and set the values of a user data object. This can be useful for developers wishing to create XML trees and adorn the trees with user defined objects.- See Also:
- Serialized Form
-
-
Field Summary
-
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 UserDataElement(java.lang.String name)
UserDataElement(QName qname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
clone
will return a deep clone or if this node is read-only then clone will return the same instance.protected Element
createElement(java.lang.String name)
protected Element
createElement(QName qName)
protected java.lang.Object
getCopyOfUserData()
If a deep copy of user data is required whenever the clone() or createCopy() methods are called on this element then this method should return a clone of the user datajava.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 asElement.getText()
void
setData(java.lang.Object data)
Sets the data value of this element if this element supports data binding or callsNode.setText(java.lang.String)
if it doesn'tjava.lang.String
toString()
-
Methods inherited from class org.dom4j.tree.DefaultElement
add, additionalNamespaces, additionalNamespaces, addNewNode, attribute, attribute, attribute, attribute, attributeCount, attributeIterator, attributeList, attributeList, attributes, clearContent, contentList, declaredNamespaces, element, element, element, getDocument, getDocumentFactory, getNamespaceForPrefix, getNamespaceForURI, getParent, getQName, getStringValue, getText, indexOf, node, nodeCount, nodeIterator, processingInstruction, processingInstructions, processingInstructions, remove, removeNode, removeProcessingInstruction, setAttributeList, setAttributes, setContent, setDocument, setParent, setQName, supportsParent
-
Methods inherited from class org.dom4j.tree.AbstractElement
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, createSingleIterator, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, 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, setName, setNamespace, setText, write
-
Methods inherited from class org.dom4j.tree.AbstractBranch
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructions
-
Methods inherited from class org.dom4j.tree.AbstractNode
asXPathResult, 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
getTextTrim
-
Methods inherited from interface org.dom4j.Node
asXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
-
-
-
-
Constructor Detail
-
UserDataElement
public UserDataElement(java.lang.String name)
-
UserDataElement
public UserDataElement(QName qname)
-
-
Method Detail
-
getData
public java.lang.Object getData()
Description copied from interface:Element
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 asElement.getText()
- Specified by:
getData
in interfaceElement
- Overrides:
getData
in classAbstractElement
- Returns:
- DOCUMENT ME!
-
setData
public void setData(java.lang.Object data)
Description copied from interface:Element
Sets the data value of this element if this element supports data binding or callsNode.setText(java.lang.String)
if it doesn't- Specified by:
setData
in interfaceElement
- Overrides:
setData
in classAbstractElement
- Parameters:
data
- DOCUMENT ME!
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractElement
-
clone
public java.lang.Object clone()
Description copied from interface:Node
clone
will return a deep clone or if this node is read-only then clone will return the same instance.- Specified by:
clone
in interfaceNode
- Overrides:
clone
in classDefaultElement
- Returns:
- a deep clone of myself or myself if I am read only.
-
getCopyOfUserData
protected java.lang.Object getCopyOfUserData()
If a deep copy of user data is required whenever the clone() or createCopy() methods are called on this element then this method should return a clone of the user data- Returns:
- DOCUMENT ME!
-
createElement
protected Element createElement(java.lang.String name)
- Overrides:
createElement
in classAbstractElement
-
createElement
protected Element createElement(QName qName)
- Overrides:
createElement
in classAbstractElement
-
-