Package org.dom4j.util
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
 
 public class IndexedElement extends DefaultElement IndexedElementis an implementation ofElementwhich maintains an index of the attributes and elements it contains to optimise lookups via name.- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from class org.dom4j.tree.AbstractElementUSE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRING
 - 
Fields inherited from class org.dom4j.tree.AbstractBranchDEFAULT_CONTENT_LIST_SIZE
 - 
Fields inherited from class org.dom4j.tree.AbstractNodeNODE_TYPE_NAMES
 - 
Fields inherited from interface org.dom4j.NodeANY_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 SummaryConstructors Constructor Description IndexedElement(String name)IndexedElement(QName qname)IndexedElement(QName qname, int attributeCount)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddNode(Node node)protected voidaddToAttributeIndex(Object key, Attribute value)protected voidaddToAttributeIndex(Attribute attribute)protected voidaddToElementIndex(Object key, Element value)protected voidaddToElementIndex(Element element)protected ElementasElement(Object object)protected Iterator<Element>asElementIterator(Object object)Deprecated.WILL BE REMOVED IN dom4j-1.6 !!protected List<Element>asElementList(Object object)Attributeattribute(String name)Returns the attribute with the given nameAttributeattribute(QName qName)DOCUMENT ME!protected Map<Object,Attribute>attributeIndex()protected Map<Object,Attribute>createAttributeIndex()A Factory Method to create the index for attributesprotected Map<Object,Object>createElementIndex()A Factory Method to create the index for elementsprotected <T> Map<Object,T>createIndex()Factory method to return a new map implementation for indicesprotected <T extends Node>
 List<T>createList()Factory method to return a list implementation for indicesElementelement(String name)Returns the first element for the given local name and any namespace.Elementelement(QName qName)Returns the first element for the given fully qualified name.protected Map<Object,Object>elementIndex()List<Element>elements(String name)Returns the elements contained in this element with the given local name and any namespace.List<Element>elements(QName qName)Returns the elements contained in this element with the given fully qualified name.protected voidremoveFromAttributeIndex(Object key, Attribute value)protected voidremoveFromAttributeIndex(Attribute attribute)protected voidremoveFromElementIndex(Object key, Element value)protected voidremoveFromElementIndex(Element element)protected booleanremoveNode(Node node)- 
Methods inherited from class org.dom4j.tree.DefaultElementadd, 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 org.dom4j.tree.AbstractElementaccept, 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 org.dom4j.tree.AbstractBranchaddElement, 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.AbstractNodeasXPathResult, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.dom4j.BranchaddElement, addElement, appendContent, content, elementByID, setProcessingInstructions
 - 
Methods inherited from interface org.dom4j.ElementgetTextTrim
 - 
Methods inherited from interface org.dom4j.NodeasXPathResult, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
 
- 
 
- 
- 
- 
Method Detail- 
attributepublic Attribute attribute(String name) Description copied from interface:ElementReturns the attribute with the given name- Specified by:
- attributein interface- Element
- Overrides:
- attributein class- DefaultElement
- 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.
 
 - 
attributepublic Attribute attribute(QName qName) Description copied from interface:ElementDOCUMENT ME!- Specified by:
- attributein interface- Element
- Overrides:
- attributein class- DefaultElement
- Parameters:
- qName- is the fully qualified name
- Returns:
- the attribute for the given fully qualified name or null if it could not be found.
 
 - 
elementpublic Element element(String name) Description copied from interface:ElementReturns the first element for the given local name and any namespace.- Specified by:
- elementin interface- Element
- Overrides:
- elementin class- DefaultElement
- Parameters:
- name- DOCUMENT ME!
- Returns:
- the first element with the given local name
 
 - 
elementpublic Element element(QName qName) Description copied from interface:ElementReturns the first element for the given fully qualified name.- Specified by:
- elementin interface- Element
- Overrides:
- elementin class- DefaultElement
- Parameters:
- qName- is the fully qualified name to search for
- Returns:
- the first element with the given fully qualified name
 
 - 
elementspublic List<Element> elements(String name) Description copied from interface:ElementReturns 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:
- elementsin interface- Element
- Overrides:
- elementsin class- AbstractElement
- Parameters:
- name- DOCUMENT ME!
- Returns:
- a list of all the elements in this element for the given local name
 
 - 
elementspublic List<Element> elements(QName qName) Description copied from interface:ElementReturns 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:
- elementsin interface- Element
- Overrides:
- elementsin class- AbstractElement
- 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.
 
 - 
asElementIteratorprotected Iterator<Element> asElementIterator(Object object) Deprecated.WILL BE REMOVED IN dom4j-1.6 !!DOCUMENT ME!- Parameters:
- object- DOCUMENT ME!
- Returns:
- DOCUMENT ME!
 
 - 
addNodeprotected void addNode(Node node) - Overrides:
- addNodein class- AbstractElement
 
 - 
removeNodeprotected boolean removeNode(Node node) - Overrides:
- removeNodein class- DefaultElement
 
 - 
createAttributeIndexprotected Map<Object,Attribute> createAttributeIndex() A Factory Method to create the index for attributes- Returns:
- DOCUMENT ME!
 
 - 
createElementIndexprotected Map<Object,Object> createElementIndex() A Factory Method to create the index for elements- Returns:
- DOCUMENT ME!
 
 - 
addToElementIndexprotected void addToElementIndex(Element element) 
 - 
removeFromElementIndexprotected void removeFromElementIndex(Element element) 
 - 
addToAttributeIndexprotected void addToAttributeIndex(Attribute attribute) 
 - 
removeFromAttributeIndexprotected void removeFromAttributeIndex(Attribute attribute) 
 - 
createIndexprotected <T> Map<Object,T> createIndex() Factory method to return a new map implementation for indices- Type Parameters:
- T- DOCUMENT ME!
- Returns:
- DOCUMENT ME!
 
 
- 
 
-