com.jfimagine.jfdom
Class Element

java.lang.Object
  |
  +--com.jfimagine.jfdom.Element

public class Element
extends java.lang.Object

Element class. A class used to represent an XML element.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Constructor Summary
Element()
          Constructor
Element(java.lang.String tag)
          Constructor
Element(java.lang.String tag, boolean value)
          Constructor
Element(java.lang.String tag, java.util.Date value)
          Constructor
Element(java.lang.String tag, double value)
          Constructor
Element(java.lang.String tag, int value)
          Constructor
Element(java.lang.String tag, java.lang.String value)
          Constructor
 
Method Summary
 void addChild(Element child)
          add child element
static boolean getBooleanValue(Element element)
          Get value in boolean
 Element getChild(java.lang.String tag)
          get child element by tag.
 java.util.List getChildren()
          Get child elements
 int getChildrenCount()
          Get count of child elements
static java.util.Date getDateValue(Element element)
          Get value in java.util.Date
static double getDoubleValue(Element element)
          Get value in double
static int getIntValue(Element element)
          Get value in integer
static java.lang.String getStringValue(Element element)
          Get value in string.
 java.lang.String getTag()
          Get tag string.
 java.lang.String getValue()
          Get value in string.
 boolean hasChildren()
          If this element has children
 void setChildren(java.util.List children)
          Set child elements
 void setTag(java.lang.String tag)
          Set tag string.
 void setValue(boolean value)
          Set value in boolean.
 void setValue(java.util.Date value)
          Set value in java.util.Date.
 void setValue(double value)
          Set value in double.
 void setValue(int value)
          Set value in int.
 void setValue(java.lang.String value)
          Get value in string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Element

public Element()
Constructor


Element

public Element(java.lang.String tag)
Constructor


Element

public Element(java.lang.String tag,
               java.lang.String value)
Constructor


Element

public Element(java.lang.String tag,
               int value)
Constructor


Element

public Element(java.lang.String tag,
               double value)
Constructor


Element

public Element(java.lang.String tag,
               java.util.Date value)
Constructor


Element

public Element(java.lang.String tag,
               boolean value)
Constructor

Method Detail

getTag

public java.lang.String getTag()
Get tag string.

Returns:
tag string

setTag

public void setTag(java.lang.String tag)
Set tag string.

Parameters:
tag - The tag string

getValue

public java.lang.String getValue()
Get value in string.

Returns:
value in string.

setValue

public void setValue(java.lang.String value)
Get value in string.

Parameters:
value - Value in string.

setValue

public void setValue(int value)
Set value in int.

Parameters:
value - Value in int.

setValue

public void setValue(double value)
Set value in double.

Parameters:
value - Value in double.

setValue

public void setValue(java.util.Date value)
Set value in java.util.Date.

Parameters:
value - Value in java.util.Date.

setValue

public void setValue(boolean value)
Set value in boolean.

Parameters:
value - Value in boolean.

getStringValue

public static java.lang.String getStringValue(Element element)
Get value in string.

Parameters:
element - An element to get value.
Returns:
value in string.

getIntValue

public static int getIntValue(Element element)
Get value in integer

Returns:
value in integer

getDoubleValue

public static double getDoubleValue(Element element)
Get value in double

Returns:
value in double

getDateValue

public static java.util.Date getDateValue(Element element)
Get value in java.util.Date

Returns:
value in java.util.Date

getBooleanValue

public static boolean getBooleanValue(Element element)
Get value in boolean

Returns:
value in boolean

getChildren

public java.util.List getChildren()
Get child elements

Returns:
the child elements.

setChildren

public void setChildren(java.util.List children)
Set child elements

Parameters:
children - new child elements.

getChildrenCount

public int getChildrenCount()
Get count of child elements

Returns:
the children count

hasChildren

public boolean hasChildren()
If this element has children

Returns:
True if has children, false otherwise.

addChild

public void addChild(Element child)
add child element

Parameters:
child - A new child element.

getChild

public Element getChild(java.lang.String tag)
get child element by tag.

Returns:
child found.


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.