public class IndexedElement extends DefaultElement
IndexedElement
is an implementation of Element
which
maintains an index of the attributes and elements it contains to optimise
lookups via name.USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING
DEFAULT_CONTENT_LIST_SIZE
NODE_TYPE_NAMES
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 and Description |
---|
IndexedElement(QName qname) |
IndexedElement(QName qname,
int attributeCount) |
IndexedElement(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
addNode(Node node) |
protected void |
addToAttributeIndex(Attribute attribute) |
protected void |
addToAttributeIndex(java.lang.Object key,
Attribute value) |
protected void |
addToElementIndex(Element element) |
protected void |
addToElementIndex(java.lang.Object key,
Element value) |
protected Element |
asElement(java.lang.Object object) |
protected java.util.Iterator<Element> |
asElementIterator(java.lang.Object object)
Deprecated.
WILL BE REMOVED IN dom4j-1.6 !!
|
protected java.util.List<Element> |
asElementList(java.lang.Object object) |
Attribute |
attribute(QName qName)
DOCUMENT ME!
|
Attribute |
attribute(java.lang.String name)
Returns the attribute with the given name
|
protected java.util.Map<java.lang.Object,Attribute> |
attributeIndex() |
protected java.util.Map<java.lang.Object,Attribute> |
createAttributeIndex()
A Factory Method to create the index for attributes
|
protected java.util.Map<java.lang.Object,java.lang.Object> |
createElementIndex()
A Factory Method to create the index for elements
|
protected <T> java.util.Map<java.lang.Object,T> |
createIndex()
Factory method to return a new map implementation for indices
|
protected <T extends Node> |
createList()
Factory method to return a list implementation for indices
|
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.
|
protected java.util.Map<java.lang.Object,java.lang.Object> |
elementIndex() |
java.util.List<Element> |
elements(QName qName)
Returns the elements contained in this element with the given fully
qualified name.
|
java.util.List<Element> |
elements(java.lang.String name)
Returns the elements contained in this element with the given local name
and any namespace.
|
protected void |
removeFromAttributeIndex(Attribute attribute) |
protected void |
removeFromAttributeIndex(java.lang.Object key,
Attribute value) |
protected void |
removeFromElementIndex(Element element) |
protected void |
removeFromElementIndex(java.lang.Object key,
Element value) |
protected boolean |
removeNode(Node node) |
add, additionalNamespaces, additionalNamespaces, addNewNode, attribute, attribute, attributeCount, attributeIterator, attributeList, attributeList, attributes, clearContent, clone, contentList, declaredNamespaces, element, getDocument, getDocumentFactory, getNamespaceForPrefix, getNamespaceForURI, getParent, getQName, getStringValue, getText, indexOf, node, nodeCount, nodeIterator, processingInstruction, processingInstructions, processingInstructions, remove, removeProcessingInstruction, setAttributeList, setAttributes, setContent, setDocument, setParent, setQName, supportsParent
accept, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, addNamespace, addNewNode, addNode, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attributeValue, attributeValue, attributeValue, attributeValue, createAttributeList, createAttributeList, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, elementIterator, elementIterator, elementIterator, elementIterator, 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, write
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructions
asXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getTextTrim
addElement, addElement, appendContent, content, elementByID, setProcessingInstructions
asXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
public IndexedElement(java.lang.String name)
public IndexedElement(QName qname)
public IndexedElement(QName qname, int attributeCount)
public Attribute attribute(java.lang.String name)
Element
attribute
in interface Element
attribute
in class DefaultElement
name
- DOCUMENT ME!public Attribute attribute(QName qName)
Element
attribute
in interface Element
attribute
in class DefaultElement
qName
- is the fully qualified namepublic Element element(java.lang.String name)
Element
element
in interface Element
element
in class DefaultElement
name
- DOCUMENT ME!public Element element(QName qName)
Element
element
in interface Element
element
in class DefaultElement
qName
- is the fully qualified name to search forpublic java.util.List<Element> elements(java.lang.String name)
Element
elements
in interface Element
elements
in class AbstractElement
name
- DOCUMENT ME!public java.util.List<Element> elements(QName qName)
Element
elements
in interface Element
elements
in class AbstractElement
qName
- is the fully qualified name to search forprotected Element asElement(java.lang.Object object)
protected java.util.List<Element> asElementList(java.lang.Object object)
protected java.util.Iterator<Element> asElementIterator(java.lang.Object object)
object
- DOCUMENT ME!protected void addNode(Node node)
addNode
in class AbstractElement
protected boolean removeNode(Node node)
removeNode
in class DefaultElement
protected java.util.Map<java.lang.Object,Attribute> attributeIndex()
protected java.util.Map<java.lang.Object,java.lang.Object> elementIndex()
protected java.util.Map<java.lang.Object,Attribute> createAttributeIndex()
protected java.util.Map<java.lang.Object,java.lang.Object> createElementIndex()
protected void addToElementIndex(Element element)
protected void addToElementIndex(java.lang.Object key, Element value)
protected void removeFromElementIndex(Element element)
protected void removeFromElementIndex(java.lang.Object key, Element value)
protected void addToAttributeIndex(Attribute attribute)
protected void addToAttributeIndex(java.lang.Object key, Attribute value)
protected void removeFromAttributeIndex(Attribute attribute)
protected void removeFromAttributeIndex(java.lang.Object key, Attribute value)
protected <T> java.util.Map<java.lang.Object,T> createIndex()
T
- DOCUMENT ME!protected <T extends Node> java.util.List<T> createList()
T
- DOCUMENT ME!