Flash Weather

de.flashweather.io.util
Class ConfigDocument

java.lang.Object
  |
  +--de.flashweather.io.util.ConfigDocument

public class ConfigDocument
extends java.lang.Object

A class representing a configuration file written in a language defined in XML:

 <config>
     <category1 attr1="value1"
                attr2="value2" ... />
     <category2 ... />
     ...
 </config>
 
The class can read all kinds of tag and attribute names, the only restriction is the config document tag that has to exists and the structur of the file.

Author:
Benjamin Stark

Field Summary
protected  org.w3c.dom.Node currentnode
          The current configuration instruction.
protected  org.w3c.dom.Document doc
          The configuration document as an object tree.
protected  boolean resetted
          True, after the read process has been resetted.
 
Constructor Summary
ConfigDocument(org.xml.sax.InputSource in)
          Constructs a configuration file object from an input source object
ConfigDocument(java.lang.String filename)
          Constructs a configuration file object from a file name
 
Method Summary
 org.w3c.dom.Element getNextElement()
          Get the next configuration instruction.
 boolean hasNextElement()
          Check if another configuration instruction follows.
 void reset()
          Restart at the beginning of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected org.w3c.dom.Document doc
The configuration document as an object tree.

currentnode

protected org.w3c.dom.Node currentnode
The current configuration instruction.

resetted

protected boolean resetted
True, after the read process has been resetted.
Constructor Detail

ConfigDocument

public ConfigDocument(java.lang.String filename)
               throws java.io.IOException,
                      org.xml.sax.SAXException
Constructs a configuration file object from a file name
Parameters:
filename - the configuration file's name

ConfigDocument

public ConfigDocument(org.xml.sax.InputSource in)
               throws java.io.IOException,
                      org.xml.sax.SAXException
Constructs a configuration file object from an input source object
Parameters:
in - input source with configuration file content
Method Detail

reset

public void reset()
Restart at the beginning of the file.

hasNextElement

public boolean hasNextElement()
Check if another configuration instruction follows.
Returns:
true, if another configuration instruction follows

getNextElement

public org.w3c.dom.Element getNextElement()
Get the next configuration instruction.
Returns:
next configuration instruction

Flash Weather

© 2001 Benjamin Stark