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.
-
attrs
- The element's attributes.
-
children
- The element's children.
-
isEmpty
- Marks the element as an empty element.
-
name
- The element's name.
-
Element(String, AttributeList)
- Constructs a new, non-empty Element.
-
Element(String, AttributeList, boolean)
- Constructs a new Element.
-
addAttribute(Attribute)
- Adds an additional attribute to the Element.
-
addAttributes(AttributeList)
- Adds additional attributes to the Element.
-
addChild(MarkupNode)
- Adds a new child to the Element.
-
getChildAt(int)
- Returns the child element at the specified position.
-
getChildCount()
- Returns the number of children attached to the element.
-
getEndTag()
- Gets the Element's end tag.
-
getStartTag()
- Gets the Element's start tag.
-
isEmptyElement()
- Determines if this is an "empty" element, i.e one that cannot contain
any children.
-
toString(MarkupReader, int)
-
name
protected String name
- The element's name.
children
protected MarkupNodeList children
- The element's children.
attrs
protected AttributeList attrs
- The element's attributes.
isEmpty
protected boolean isEmpty
- Marks the element as an empty element.
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.
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.
addAttribute
public void addAttribute(Attribute attr)
- Adds an additional attribute to the Element.
- Parameters:
- attr - the Attribute to add.
addAttributes
public void addAttributes(AttributeList attrs)
- Adds additional attributes to the Element.
- Parameters:
- attrs - the AttributeList to append.
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.
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
getChildCount
public int getChildCount()
- Returns the number of children attached to the element.
- Returns:
- number of children
getStartTag
public String getStartTag()
- Gets the Element's start tag.
- Returns:
- Returns a string representation of the Element's start tag.
getEndTag
public String getEndTag()
- Gets the Element's end tag.
- Returns:
- Returns a string representation of the Element's end node.
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.
toString
public boolean toString(MarkupReader reader,
int depth)
All Packages Class Hierarchy This Package Previous Next Index