edu.ucsb.nceas.metacat
Class BasicElement

java.lang.Object
  |
  +--edu.ucsb.nceas.metacat.BasicElement
Direct Known Subclasses:
DBSAXElement, ReaderElement

public class BasicElement
extends java.lang.Object

A Class that represents an XML element and its contents


Constructor Summary
BasicElement()
          Construct a Basic Element
BasicElement(long element_id, java.lang.String tagname, long parent_id, int nodeIndex)
          Construct a Basic Element
BasicElement(java.lang.String tagname, long parent_id, int nodeIndex)
          Construct a Basic Element
 
Method Summary
 void appendContent(char[] cbuf, int start, int len)
          Append to the content of the element
 void appendContent(java.lang.String new_content)
          Append to the content of the element
 java.lang.String getAttribute(java.lang.String attName)
          Get an attribute value by name
 java.lang.String getAttributes()
          Get the attributes as a string
 java.lang.String getContent()
          Get the content of the element
 long getElementID()
          Get the id of this element
 int getNodeIndex()
          Get nodeIndex of the element
 long getParentID()
          Get the parent id of this element
 java.lang.String getTagName()
          Get the name of this element
 int incChildNum()
          increase childNum when new child for the element is created
 void setAttribute(java.lang.String attName, java.lang.String attValue)
          Add a new attribute to this element, or set its value
 void setElementID(long element_id)
          Set the id of this element
 void setParentID(long parent_id)
          Set the parent id of this element
 void setTagName(java.lang.String tagname)
          Set the tagname of this element
 java.lang.String toString()
          convert the element to a string representation for display
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicElement

public BasicElement()
Construct a Basic Element

BasicElement

public BasicElement(java.lang.String tagname,
                    long parent_id,
                    int nodeIndex)
Construct a Basic Element
Parameters:
tagname - the name of the element
parent_id - the id number of the parent element
nodeIndex - - number of the element in the order for a given parent node Every element initializes childNum to 0 when created and has interface incChildNum when new child is created

BasicElement

public BasicElement(long element_id,
                    java.lang.String tagname,
                    long parent_id,
                    int nodeIndex)
Construct a Basic Element
Parameters:
element_id - the id number of the element
tagname - the name of the element
parent_id - the id number of the parent element
Method Detail

toString

public java.lang.String toString()
convert the element to a string representation for display
Overrides:
toString in class java.lang.Object

getElementID

public long getElementID()
Get the id of this element

setElementID

public void setElementID(long element_id)
Set the id of this element

getParentID

public long getParentID()
Get the parent id of this element

setParentID

public void setParentID(long parent_id)
Set the parent id of this element

getTagName

public java.lang.String getTagName()
Get the name of this element

setTagName

public void setTagName(java.lang.String tagname)
Set the tagname of this element

getAttributes

public java.lang.String getAttributes()
Get the attributes as a string

setAttribute

public void setAttribute(java.lang.String attName,
                         java.lang.String attValue)
Add a new attribute to this element, or set its value

getAttribute

public java.lang.String getAttribute(java.lang.String attName)
Get an attribute value by name

appendContent

public void appendContent(char[] cbuf,
                          int start,
                          int len)
Append to the content of the element

appendContent

public void appendContent(java.lang.String new_content)
Append to the content of the element

getContent

public java.lang.String getContent()
Get the content of the element

getNodeIndex

public int getNodeIndex()
Get nodeIndex of the element

incChildNum

public int incChildNum()
increase childNum when new child for the element is created