Class BaseElement

All Implemented Interfaces:
Serializable, Cloneable, Branch, Element, Node
Direct Known Subclasses:
NonLazyElement

public class BaseElement extends AbstractElement

BaseElement is a useful base class for implemementation inheritence of an XML element.

Version:
$Revision: 1.9 $
Author:
James Strachan
See Also:
  • Field Details

    • content

      protected List content
      List of content nodes.
    • attributes

      protected List attributes
      list of attributes
  • Constructor Details

    • BaseElement

      public BaseElement(String name)
    • BaseElement

      public BaseElement(QName qname)
    • BaseElement

      public BaseElement(String name, Namespace namespace)
  • Method Details

    • getParent

      public Element getParent()
      Description copied from interface: Node

      getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

      This method is an optional feature and may not be supported for all Node implementations.

      Specified by:
      getParent in interface Node
      Overrides:
      getParent in class AbstractNode
      Returns:
      the parent of this node or null if it is the root of the tree or the parent relationship is not supported.
    • setParent

      public void setParent(Element parent)
      Description copied from interface: Node

      setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

      This method should only be called from inside an Element implementation method and is not intended for general use.

      Specified by:
      setParent in interface Node
      Overrides:
      setParent in class AbstractNode
      Parameters:
      parent - is the new parent of this node.
    • getDocument

      public Document getDocument()
      Description copied from interface: Node

      getDocument returns the Document that this Node is part of if this node supports the parent relationship.

      This method is an optional feature and may not be supported for all Node implementations.

      Specified by:
      getDocument in interface Node
      Overrides:
      getDocument in class AbstractNode
      Returns:
      the document of this node or null if this feature is not supported or the node is not associated with a Document
    • setDocument

      public void setDocument(Document document)
      Description copied from interface: Node

      setDocument sets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

      This method should only be called from inside a Document implementation method and is not intended for general use.

      Specified by:
      setDocument in interface Node
      Overrides:
      setDocument in class AbstractNode
      Parameters:
      document - is the new document of this node.
    • supportsParent

      public boolean supportsParent()
      Description copied from interface: Node

      supportsParent returns true if this node supports the parent relationship.

      Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

      Specified by:
      supportsParent in interface Node
      Overrides:
      supportsParent in class AbstractNode
      Returns:
      true if this node supports the parent relationship or false it is not supported
    • getQName

      public QName getQName()
      Description copied from interface: Element

      Returns the QName of this element which represents the local name, the qualified name and the Namespace.

      Returns:
      the QName associated with this element
    • setQName

      public void setQName(QName name)
      Description copied from interface: Element

      Sets the QName of this element which represents the local name, the qualified name and the Namespace.

      Parameters:
      name - is the QName to be associated with this element
    • clearContent

      public void clearContent()
      Description copied from interface: Branch
      Clears the content for this branch, removing any Node instances this branch may contain.
    • setContent

      public void setContent(List content)
      Description copied from interface: Branch
      Sets the contents of this branch as a List of Node instances.
      Parameters:
      content - is the list of nodes to use as the content for this branch.
    • setAttributes

      public void setAttributes(List attributes)
      Description copied from interface: Element
      Sets the attributes that this element contains
      Parameters:
      attributes - DOCUMENT ME!
    • contentList

      protected List contentList()
      Description copied from class: AbstractBranch
      DOCUMENT ME!
      Specified by:
      contentList in class AbstractBranch
      Returns:
      the internal List used to manage the content
    • attributeList

      protected List attributeList()
      Description copied from class: AbstractElement
      DOCUMENT ME!
      Specified by:
      attributeList in class AbstractElement
      Returns:
      the internal List used to store attributes or creates one if one is not available
    • attributeList

      protected List attributeList(int size)
      Description copied from class: AbstractElement
      DOCUMENT ME!
      Specified by:
      attributeList in class AbstractElement
      Parameters:
      size - DOCUMENT ME!
      Returns:
      the internal List used to store attributes or creates one with the specified size if one is not available
    • setAttributeList

      protected void setAttributeList(List attributeList)