tuwien.auto.calimero.xml
Interface Element

All Known Implementing Classes:
DefaultElement

public interface Element

Represents a XML element holding necessary information for reading XML data.


Method Summary
 void addAttribute(Attribute a)
          Adds a new attribute associated with this element.
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the attribute with name.
 java.lang.String getCharacterData()
          Returns the character data contained in this element.
 java.lang.String getName()
          Returns the name of this element, the element type.
 boolean hasAttribute(java.lang.String name)
          Returns whether an attribute with the given name is associated with this element.
 boolean isEmptyElementTag()
          Returns whether this element uses an empty element tag to indicate an empty element.
 void setCharacterData(java.lang.String data)
          Sets the character data contained in this element.
 void setEmptyElementTag(boolean empty)
          Determines if this element uses an empty element tag.
 

Method Detail

addAttribute

void addAttribute(Attribute a)
Adds a new attribute associated with this element.

Parameters:
a - the attribute to add

getAttribute

java.lang.String getAttribute(java.lang.String name)
Returns the value of the attribute with name.

Parameters:
name - name of attribute to get attribute value
Returns:
value as String, or null if no such attribute

getCharacterData

java.lang.String getCharacterData()
Returns the character data contained in this element.

Character data is the element's content without markup. No formatting is done on character data.
Put it more simple, character data is the actual value information (in textual format) of an element.

Returns:
character data as String or null if no data available

getName

java.lang.String getName()
Returns the name of this element, the element type.

Returns:
name as string, the element's type

hasAttribute

boolean hasAttribute(java.lang.String name)
Returns whether an attribute with the given name is associated with this element.

Parameters:
name - attribute name
Returns:
true if an attribute with the given name is associated with this element, false otherwise

isEmptyElementTag

boolean isEmptyElementTag()
Returns whether this element uses an empty element tag to indicate an empty element.

An element with no content is said to be empty. An empty element tag is of the form '<' Name (S Attribute)* S? '/>', with S being space. Note that if this method returns false, it does not imply this element has any content, returned by getCharacterData().

Returns:
true if empty element with empty element tag, false otherwise

setCharacterData

void setCharacterData(java.lang.String data)
Sets the character data contained in this element.

If new character data is set, the empty element tag is set false.

Parameters:
data - character data of this element, null for no data

setEmptyElementTag

void setEmptyElementTag(boolean empty)
Determines if this element uses an empty element tag.

If empty element tag is used, this element also has no content.

Parameters:
empty - true if empty element, false otherwise