org.garret.xmlme
Class XMLElement

java.lang.Object
  extended byorg.garret.xmlme.XMLElement

public class XMLElement
extends java.lang.Object

Class representing XML element


Method Summary
 XMLAttribute getAttribute(java.lang.String name)
          Get attribute with specified name
 java.util.Vector getAttributes()
          Get attributes of this element
 int getCounter()
          Get number of siblings with the same name.
 int getIntValue()
          Get integer value of the element
 java.lang.String getName()
          Get element name
 XMLElement getNextSibling()
          Return next sibling.
 XMLElement getSibling(java.lang.String name)
          Get sibling with specified name
 java.util.Vector getSiblings()
          Get siblings of this element
 java.lang.String getValue()
          Get value of this element
 java.util.Vector search(java.lang.String pattern)
          Search element siblings which name matches with the pattern
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAttribute

public XMLAttribute getAttribute(java.lang.String name)
Get attribute with specified name

Parameters:
name - name of the attribute
Returns:
element attribute with specified name or null if not found

getAttributes

public java.util.Vector getAttributes()
Get attributes of this element

Returns:
vector of attributes defined for this element

getCounter

public int getCounter()
Get number of siblings with the same name. This methood should be applied only to the element returned by getSibling method. Effect of applying this method to anyy other element is not deefined.

Returns:
number of siblings with the same name

getIntValue

public int getIntValue()
Get integer value of the element

Returns:
integer value of element
Throws:
XMLException - if this element has no value or this value is not valid integer number

getName

public java.lang.String getName()
Get element name

Returns:
name of the element

getNextSibling

public XMLElement getNextSibling()
Return next sibling. This method should be used to iterate through list of elements with the same name returned by getSibling method

Returns:
next sibling orr null if there are no more siblings with such name

getSibling

public XMLElement getSibling(java.lang.String name)
Get sibling with specified name

Parameters:
name - name of the sibling
Returns:
direcct sibling of this element with specified name. If there are more than one siblings with this name, first of them is returned and other can be obtained using getNextSibling method

getSiblings

public java.util.Vector getSiblings()
Get siblings of this element

Returns:
vector of direct siblings of this element

getValue

public java.lang.String getValue()
Get value of this element

Returns:
element value or null if element has no value

search

public java.util.Vector search(java.lang.String pattern)
Search element siblings which name matches with the pattern

Parameters:
pattern - search pattern
Returns:
vector of direct or indirect siblings of this element which name contains specified search pattern as substring