gist.hydrogen
Class Element

java.lang.Object
  extended by gist.hydrogen.Element

public class Element
extends java.lang.Object

The Element class decribes an Atom feed/entry as an XML tree structure. That is, it contains similar but subordinate Element objects at a lower level. This is the first-developed version used only by the Hydrogen project to convert an Atom feed into a nicely-formatted string. The final, more extensive version XMLElem can be found in the gist.protons package.

Author:
Grinnell Internet Syndication Team
See Also:
XMLElem

Field Summary
 Attribute[] attr
          Contains XML attributes as Attribute objects.
 java.lang.String data
          Contains the content of the XML element.
 Element[] elem
          Contains subordinate XML elements as Element objects
 java.lang.String tag
          XML element's tag label
 
Constructor Summary
Element(java.io.DataInputStream in)
          Contructs an Element object from an input file.
Element(java.lang.String initTag, Attribute[] initAttr, java.lang.String initData, Element[] initElem)
          Constructs an Element object from initial data fields.
 
Method Summary
 void setDoc()
          Create default setting for an Atom feed document.
 java.lang.String strElement(int level)
          Converts an XML element stored as an Element object into a string in standard XML format.
static java.lang.String timeStamp()
          Returns the current date and time in standard format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tag

public java.lang.String tag
XML element's tag label


attr

public Attribute[] attr
Contains XML attributes as Attribute objects.

See Also:
Attribute

data

public java.lang.String data
Contains the content of the XML element. The data field is a null string if the XML element contains a lower-level XML element.


elem

public Element[] elem
Contains subordinate XML elements as Element objects

Constructor Detail

Element

public Element(java.lang.String initTag,
               Attribute[] initAttr,
               java.lang.String initData,
               Element[] initElem)
Constructs an Element object from initial data fields.


Element

Element(java.io.DataInputStream in)
  throws java.lang.Exception
Contructs an Element object from an input file. This constructor is used only for testing larger feed structure.

Parameters:
in - Must be written in a special syntax or exceptions will occur.
Throws:
java.lang.Exception
Method Detail

setDoc

public void setDoc()
Create default setting for an Atom feed document.


strElement

public java.lang.String strElement(int level)
Converts an XML element stored as an Element object into a string in standard XML format.

Parameters:
level - The level of the subordinate Element object to be added to the returned string. This parameter is used only for recursive purpose. The method should be called with level equal to 0, indicating the root level of the tree structure.

timeStamp

public static java.lang.String timeStamp()
Returns the current date and time in standard format.