## 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:
  Branch, Cloneable, Element, Node, Serializable

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.

Version:
  $Revision: 1.10 $
Author:
  James Strachan
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.dom4j.tree.AbstractElement
`EMPTY_ITERATOR, EMPTY_LIST, 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
`IndexedElement(QName qname)`
`IndexedElement(QName qname, int attributeCount)`
`IndexedElement(String name)`

Method Summary
`protected void` `addNode(Node node)`
`protected void` `addToAttributeIndex(Attribute attribute)`
`protected void` `addToAttributeIndex(Object key, Attribute value)`
`protected void` `addToElementIndex(Element element)`
`protected void` `addToElementIndex(Object key, Element value)`
`protected Element` `asElement(Object object)`
`protected Iterator` `asElementIterator(Object object)` Deprecated. WILL BE REMOVED IN dom4j-1.6 !!
`protected List` `asElementList(Object object)`
`Attribute` `attribute(QName qName)` DOCUMENT ME!
`Attribute` `attribute(String name)` Returns the attribute with the given name
`protected Map` `attributeIndex()`
`protected Map` `createAttributeIndex()` A Factory Method to create the index for attributes
`protected Map` `createElementIndex()` A Factory Method to create the index for elements
`protected Map` `createIndex()` Factory method to return a new map implementation for indices
`protected List` `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(String name)` Returns the first element for the given local name and any namespace.
`protected Map` `elementIndex()`
`List` `elements(QName qName)` Returns the elements contained in this element with the given fully qualified name.
`List` `elements(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(Object key, Attribute value)`
`protected void` `removeFromElementIndex(Element element)`
`protected void` `removeFromElementIndex(Object key, Element value)`
`protected boolean` `removeNode(Node node)`

Methods inherited from class org.dom4j.tree.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 org.dom4j.tree.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 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.Element
`getTextTrim`

Methods inherited from interface org.dom4j.Branch
`addElement, addElement, appendContent, content, elementByID, setProcessingInstructions`

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

### IndexedElement

    public IndexedElement(String name)

### IndexedElement

    public IndexedElement(QName qname)

### IndexedElement

    public IndexedElement(QName qname,
                          int attributeCount)

Method Detail

### attribute

    public Attribute attribute(String name)

  Description copied from interface: `Element`
  Returns the attribute with the given name

  Specified by:
    `attribute` in interface `Element`
  Overrides:
    `attribute` in class `DefaultElement`

### attribute

    public Attribute attribute(QName qName)

  Description copied from interface: `Element`
  DOCUMENT ME!

  Specified by:
    `attribute` in interface `Element`
  Overrides:
    `attribute` in class `DefaultElement`

### element

    public Element element(String name)

  Description copied from interface: `Element`
  Returns the first element for the given local name and any namespace.

  Specified by:
    `element` in interface `Element`
  Overrides:
    `element` in class `DefaultElement`

### element

    public Element element(QName qName)

  Description copied from interface: `Element`
  Returns the first element for the given fully qualified name.

  Specified by:
    `element` in interface `Element`
  Overrides:
    `element` in class `DefaultElement`

### elements

    public List elements(String name)

  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 interface `Element`
  Overrides:
    `elements` in class `AbstractElement`

### elements

    public List elements(QName qName)

  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 interface `Element`
  Overrides:
    `elements` in class `AbstractElement`

### asElement

    protected Element asElement(Object object)

### asElementList

    protected List asElementList(Object object)

### asElementIterator

    protected Iterator asElementIterator(Object object)

  Deprecated. WILL BE REMOVED IN dom4j-1.6 !!

  DOCUMENT ME!

  Parameters:
    `object` - DOCUMENT ME!
  Returns:
    DOCUMENT ME!

### addNode

    protected void addNode(Node node)

  Overrides:
    `addNode` in class `AbstractElement`

### removeNode

    protected boolean removeNode(Node node)

  Overrides:
    `removeNode` in class `DefaultElement`

### attributeIndex

    protected Map attributeIndex()

### elementIndex

    protected Map elementIndex()

### createAttributeIndex

    protected Map createAttributeIndex()

  A Factory Method to create the index for attributes

  Returns:
    DOCUMENT ME!

### createElementIndex

    protected Map createElementIndex()

  A Factory Method to create the index for elements

  Returns:
    DOCUMENT ME!

### addToElementIndex

    protected void addToElementIndex(Element element)

### addToElementIndex

    protected void addToElementIndex(Object key,
                                     Element value)

### removeFromElementIndex

    protected void removeFromElementIndex(Element element)

### removeFromElementIndex

    protected void removeFromElementIndex(Object key,
                                          Element value)

### addToAttributeIndex

    protected void addToAttributeIndex(Attribute attribute)

### addToAttributeIndex

    protected void addToAttributeIndex(Object key,
                                       Attribute value)

### removeFromAttributeIndex

    protected void removeFromAttributeIndex(Attribute attribute)

### removeFromAttributeIndex

    protected void removeFromAttributeIndex(Object key,
                                            Attribute value)

### createIndex

    protected Map createIndex()

  Factory method to return a new map implementation for indices

  Returns:
    DOCUMENT ME!

### createList

    protected List createList()

  Factory method to return a list implementation for indices

  Returns:
    DOCUMENT ME!

Copyright © 2001-2005 MetaStuff Ltd.. All Rights Reserved.