Class IndexedElement
java.lang.Object
org.dom4j.tree.AbstractNode
org.dom4j.tree.AbstractBranch
org.dom4j.tree.AbstractElement
org.dom4j.tree.DefaultElement
org.dom4j.util.IndexedElement
- All Implemented Interfaces:
Serializable, Cloneable, Branch, Element, Node
IndexedElement
is an implementation of Element
which
maintains an index of the attributes and elements it contains to optimise
lookups via name.- Version:
- $Revision: 1.10 $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionLazily constructed index for attributes Keys are of type QName and String Values are of type <A>Lazily constructed index for elements Keys are of type QName and String Values are of type Element and List<Element>Fields inherited from class AbstractElement
USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING
Fields inherited from class AbstractBranch
DEFAULT_CONTENT_LIST_SIZE
Fields inherited from class AbstractNode
NODE_TYPE_NAMES
Fields inherited from interface 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
ConstructorsConstructorDescriptionIndexedElement
(String name) IndexedElement
(QName qname) IndexedElement
(QName qname, int attributeCount) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addToAttributeIndex
(Object key, Attribute value) protected void
addToAttributeIndex
(Attribute attribute) protected void
addToElementIndex
(Object key, Element value) protected void
addToElementIndex
(Element element) protected Element
asElementIterator
(Object object) Deprecated.WILL BE REMOVED IN dom4j-1.6 !!asElementList
(Object object) Returns the attribute with the given nameDOCUMENT ME!A Factory Method to create the index for attributesA Factory Method to create the index for elementsFactory method to return a new map implementation for indicesFactory method to return a list implementation for indicesReturns the first element for the given local name and any namespace.Returns the first element for the given fully qualified name.Returns the elements contained in this element with the given local name and any namespace.Returns the elements contained in this element with the given fully qualified name.protected void
removeFromAttributeIndex
(Object key, Attribute value) protected void
removeFromAttributeIndex
(Attribute attribute) protected void
removeFromElementIndex
(Object key, Element value) protected void
removeFromElementIndex
(Element element) protected boolean
removeNode
(Node node) Methods inherited from class DefaultElement
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
Methods inherited from class AbstractElement
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, childAdded, childRemoved, 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, isRootElement, isTextOnly, normalize, remove, remove, remove, remove, remove, remove, remove, remove, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, toString, write
Methods inherited from class 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 AbstractNode
asXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface Branch
addElement, addElement, appendContent, content, elementByID, setProcessingInstructions
Methods inherited from interface Element
getTextTrim
Methods inherited from interface Node
asXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
-
Field Details
-
elementIndex
-
attributeIndex
-
-
Constructor Details
-
IndexedElement
-
IndexedElement
-
IndexedElement
-
-
Method Details
-
attribute
Description copied from interface:Element
Returns the attribute with the given name- Specified by:
attribute
in interfaceElement
- Overrides:
attribute
in classDefaultElement
- Parameters:
name
- DOCUMENT ME!- Returns:
- the attribute for the given local name in any namespace. If there are more than one attributes with the given local name in different namespaces then the first one is returned.
-
attribute
Description copied from interface:Element
DOCUMENT ME!- Specified by:
attribute
in interfaceElement
- Overrides:
attribute
in classDefaultElement
- Parameters:
qName
- is the fully qualified name- Returns:
- the attribute for the given fully qualified name or null if it could not be found.
-
element
Description copied from interface:Element
Returns the first element for the given local name and any namespace.- Specified by:
element
in interfaceElement
- Overrides:
element
in classDefaultElement
- Parameters:
name
- DOCUMENT ME!- Returns:
- the first element with the given local name
-
element
Description copied from interface:Element
Returns the first element for the given fully qualified name.- Specified by:
element
in interfaceElement
- Overrides:
element
in classDefaultElement
- Parameters:
qName
- is the fully qualified name to search for- Returns:
- the first element with the given fully qualified name
-
elements
Description copied from interface:Element
Returns the elements contained in this element with the given local name and any namespace. If no elements are found then this method returns an empty list. 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.- Specified by:
elements
in interfaceElement
- Overrides:
elements
in classAbstractElement
- Parameters:
name
- DOCUMENT ME!- Returns:
- a list of all the elements in this element for the given local name
-
elements
Description copied from interface:Element
Returns the elements contained in this element with the given fully qualified name. If no elements are found then this method returns an empty list. 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.- Specified by:
elements
in interfaceElement
- Overrides:
elements
in classAbstractElement
- Parameters:
qName
- is the fully qualified name to search for- Returns:
- a list of all the elements in this element for the given fully qualified name.
-
asElement
-
asElementList
-
asElementIterator
-
addNode
- Overrides:
addNode
in classAbstractElement
-
removeNode
- Overrides:
removeNode
in classDefaultElement
-
attributeIndex
-
elementIndex
-
createAttributeIndex
-
createElementIndex
-
addToElementIndex
-
addToElementIndex
-
removeFromElementIndex
-
removeFromElementIndex
-
addToAttributeIndex
-
addToAttributeIndex
-
removeFromAttributeIndex
-
removeFromAttributeIndex
-
createIndex
-
createList
-