All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class vnet.markup.Element

java.lang.Object
   |
   +----vnet.markup.Element

public class Element
extends Object
implements MarkupNode
A generic XML/SGML/HTML-style markup element. An element can be added to a Document and can have other Elements added as children.

Note: vnet.markup classes are not thread safe. Locking must be performed by the application.


Variable Index

 o attrs
The element's attributes.
 o children
The element's children.
 o isEmpty
Marks the element as an empty element.
 o name
The element's name.

Constructor Index

 o Element(String, AttributeList)
Constructs a new, non-empty Element.
 o Element(String, AttributeList, boolean)
Constructs a new Element.

Method Index

 o addAttribute(Attribute)
Adds an additional attribute to the Element.
 o addAttributes(AttributeList)
Adds additional attributes to the Element.
 o addChild(MarkupNode)
Adds a new child to the Element.
 o getChildAt(int)
Returns the child element at the specified position.
 o getChildCount()
Returns the number of children attached to the element.
 o getEndTag()
Gets the Element's end tag.
 o getStartTag()
Gets the Element's start tag.
 o isEmptyElement()
Determines if this is an "empty" element, i.e one that cannot contain any children.
 o toString(MarkupReader, int)

Variables

 o name
 protected String name
The element's name.

 o children
 protected MarkupNodeList children
The element's children.

 o attrs
 protected AttributeList attrs
The element's attributes.

 o isEmpty
 protected boolean isEmpty
Marks the element as an empty element.

Constructors

 o Element
 public Element(String name,
                AttributeList attrs)
Constructs a new, non-empty Element.

Parameters:
name - the non-null elemenmt name.
attrs - a list of atributes, may be null.
 o Element
 public Element(String name,
                AttributeList attrs,
                boolean empty)
Constructs a new Element.

Parameters:
name - the non-null elemenmt name.
attrs - a list of atributes, may be null.
empty - if true, denotes an empty element.

Methods

 o addAttribute
 public void addAttribute(Attribute attr)
Adds an additional attribute to the Element.

Parameters:
attr - the Attribute to add.
 o addAttributes
 public void addAttributes(AttributeList attrs)
Adds additional attributes to the Element.

Parameters:
attrs - the AttributeList to append.
 o addChild
 public void addChild(MarkupNode child) throws IllegalChildMarkupException
Adds a new child to the Element.

Parameters:
child - the MarkupNode to be added as a child.
Throws: IllegalChildMarkupException
if adding to "empty" element.
 o getChildAt
 public MarkupNode getChildAt(int pos) throws ArrayIndexOutOfBoundsException
Returns the child element at the specified position.

Parameters:
pos - position of child to return
Returns:
child at the given position
Throws: ArrayIndexOutOfBoundsException
if pos is less than 0 or greater than or equal to the number of children
 o getChildCount
 public int getChildCount()
Returns the number of children attached to the element.

Returns:
number of children
 o getStartTag
 public String getStartTag()
Gets the Element's start tag.

Returns:
Returns a string representation of the Element's start tag.
 o getEndTag
 public String getEndTag()
Gets the Element's end tag.

Returns:
Returns a string representation of the Element's end node.
 o isEmptyElement
 public boolean isEmptyElement()
Determines if this is an "empty" element, i.e one that cannot contain any children.

Returns:
Returns trues if this is an "empty" element, false otherwise.
 o toString
 public boolean toString(MarkupReader reader,
                         int depth)

All Packages  Class Hierarchy  This Package  Previous  Next  Index