org.base.apps.xml.elem
Interface Element

All Known Implementing Classes:
BaseElement

public interface Element

Utility class to represent an XML tree.

Author:
Kevan Simpson

Method Summary
 Element addAttribute(Attr attr)
          Adds the specified attribute.
 Element addChild(Element elem)
          Adds the specified child Element.
 Element appendText(String text)
          Appends text to this element's character content.
 Attr getAttribute(String name)
          Fetches an attribute by name.
 Iterator<Attr> getAttributes()
          Fetches this Element's attributes.
 Element getChild(int index)
          Fetches a child Element by index.
 Iterator<Element> getChildren()
          Returns this Element's children.
 ElementContext getContext()
          Returns the context of this Element.
 Element getParent()
          Returns the element's parent, which may be null.
 Tag getTag()
          Returns the element tag.
 String getText()
          Returns the character content of this Element.
 Element removeAttribute(Attr attr)
          Remove the given attribute.
 Element removeAttribute(String name)
          Remove an attribute by name.
 Element removeChild(Element elem)
          Remove the specified child Element.
 Element removeChild(int index)
          Remove a child Element by index.
 Element setContext(ElementContext ctx)
          Sets the context of this Element.
 Element setParent(Element parent)
          Sets the parent of this Element.
 Element setText(String text)
          Sets the character content of this Element.
 

Method Detail

getTag

Tag getTag()
Returns the element tag.

Returns:
the element tag.

addAttribute

Element addAttribute(Attr attr)
Adds the specified attribute.

Parameters:
attr - The attribute to add.
Returns:
this Element

getAttribute

Attr getAttribute(String name)
Fetches an attribute by name.

Parameters:
name - The attribute name.
Returns:
the attribute or null, if no attribute with the given name exists

getAttributes

Iterator<Attr> getAttributes()
Fetches this Element's attributes.

Returns:
this Element's attributes.

removeAttribute

Element removeAttribute(Attr attr)
Remove the given attribute.

Parameters:
attr - The attribute to remove
Returns:
this Element

removeAttribute

Element removeAttribute(String name)
Remove an attribute by name.

Parameters:
name - The name of the attribute to remove
Returns:
this Element

addChild

Element addChild(Element elem)
Adds the specified child Element.

Parameters:
elem - The child to add.
Returns:
this Element

getChild

Element getChild(int index)
Fetches a child Element by index.

Parameters:
index - The index of the child to fetch
Returns:
the child or null, if no child with the given name exists

getChildren

Iterator<Element> getChildren()
Returns this Element's children.

Returns:
this Element's children

removeChild

Element removeChild(Element elem)
Remove the specified child Element.

Parameters:
elem - The child to remove.
Returns:
this Element

removeChild

Element removeChild(int index)
Remove a child Element by index.

Parameters:
index - The index of the child to remove
Returns:
this Element

getParent

Element getParent()
Returns the element's parent, which may be null.

Returns:
the element's parent or null.

setParent

Element setParent(Element parent)
Sets the parent of this Element.

Parameters:
parent - The parent to set
Returns:
this Element

appendText

Element appendText(String text)
Appends text to this element's character content.

Parameters:
text - The content to append.
Returns:
this Element

getContext

ElementContext getContext()
Returns the context of this Element.

Returns:
the context of this Element.

setContext

Element setContext(ElementContext ctx)
Sets the context of this Element.

Parameters:
ctx - The context to set
Returns:
this Element

getText

String getText()
Returns the character content of this Element.

Returns:
the character content of this Element.

setText

Element setText(String text)
Sets the character content of this Element.

Parameters:
text - The character content to set
Returns:
this Element

Please visit Base Apps, hosted on Sourceforge.net.

Copyright 2011, Blue Agate Software Entity (BASE)