Class IndexedElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Branch, Element, Node

    public class IndexedElement
    extends DefaultElement
    IndexedElement is an implementation of Elementwhich maintains an index of the attributes and elements it contains to optimise lookups via name.
    See Also:
    Serialized Form
    • Constructor Detail

      • IndexedElement

        public IndexedElement​(java.lang.String name)
      • IndexedElement

        public IndexedElement​(QName qname)
      • IndexedElement

        public IndexedElement​(QName qname,
                              int attributeCount)
    • Method Detail

      • attribute

        public Attribute attribute​(java.lang.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
        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

        public Attribute attribute​(QName qName)
        Description copied from interface: Element
        DOCUMENT ME!
        Specified by:
        attribute in interface Element
        Overrides:
        attribute in 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.
      • element

        public Element element​(java.lang.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
        Parameters:
        name - DOCUMENT ME!
        Returns:
        the first element with the given local name
      • 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
        Parameters:
        qName - is the fully qualified name to search for
        Returns:
        the first element with the given fully qualified name
      • elements

        public java.util.List<Element> elements​(java.lang.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
        Parameters:
        name - DOCUMENT ME!
        Returns:
        a list of all the elements in this element for the given local name
      • elements

        public java.util.List<Element> 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
        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

        protected Element asElement​(java.lang.Object object)
      • asElementList

        protected java.util.List<Element> asElementList​(java.lang.Object object)
      • asElementIterator

        protected java.util.Iterator<Element> asElementIterator​(java.lang.Object object)
        Deprecated.
        WILL BE REMOVED IN dom4j-1.6 !!
        DOCUMENT ME!
        Parameters:
        object - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • attributeIndex

        protected java.util.Map<java.lang.Object,​Attribute> attributeIndex()
      • elementIndex

        protected java.util.Map<java.lang.Object,​java.lang.Object> elementIndex()
      • createAttributeIndex

        protected java.util.Map<java.lang.Object,​Attribute> createAttributeIndex()
        A Factory Method to create the index for attributes
        Returns:
        DOCUMENT ME!
      • createElementIndex

        protected java.util.Map<java.lang.Object,​java.lang.Object> createElementIndex()
        A Factory Method to create the index for elements
        Returns:
        DOCUMENT ME!
      • addToElementIndex

        protected void addToElementIndex​(Element element)
      • addToElementIndex

        protected void addToElementIndex​(java.lang.Object key,
                                         Element value)
      • removeFromElementIndex

        protected void removeFromElementIndex​(Element element)
      • removeFromElementIndex

        protected void removeFromElementIndex​(java.lang.Object key,
                                              Element value)
      • addToAttributeIndex

        protected void addToAttributeIndex​(Attribute attribute)
      • addToAttributeIndex

        protected void addToAttributeIndex​(java.lang.Object key,
                                           Attribute value)
      • removeFromAttributeIndex

        protected void removeFromAttributeIndex​(Attribute attribute)
      • removeFromAttributeIndex

        protected void removeFromAttributeIndex​(java.lang.Object key,
                                                Attribute value)
      • createIndex

        protected <T> java.util.Map<java.lang.Object,​T> createIndex()
        Factory method to return a new map implementation for indices
        Type Parameters:
        T - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • createList

        protected <T extends Node> java.util.List<T> createList()
        Factory method to return a list implementation for indices
        Type Parameters:
        T - DOCUMENT ME!
        Returns:
        DOCUMENT ME!