All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class vnet.util.XMLProperties

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----java.util.Properties
                           |
                           +----vnet.util.XMLProperties

public class XMLProperties
extends Properties
A subclass of java.util.Properties which uses XML as it's save format. The result is more flexable, strings can contain arbitary characters that Properties doesn't like ('=', for one, IIRC).

Pass the system property "XMLProperties.parser" with an appropriate value to set the parser to use, otherwise it will attempt to use Jim Clark's XP. Whichever parser is used, it must be in the classpath for the whole thing to work. The SAX 1.0 API classes (org.xml.sax.*) must also be in the current classpath.

fix: put DTD here, for now, run the test, it will generate a sample.


Constructor Index

 o XMLProperties()
Constructs a new, empty XMLProperties.
 o XMLProperties(InputStream)
Constructs a new, empty XMLProperties from the given InputStream.
 o XMLProperties(InputStream, Properties)
Constructs a new XMLProperties from the given InputStream with the specified defaults.
 o XMLProperties(Properties)
Constructs a new, empty XMLProperties with the specified defaults.

Method Index

 o load(InputStream)
Loads the properties from the given InputStream.
 o main(String[])
Quick test.
 o save(OutputStream, String)
Saves the properties the the given OutputStream.

Constructors

 o XMLProperties
 public XMLProperties()
Constructs a new, empty XMLProperties.

 o XMLProperties
 public XMLProperties(Properties defaults)
Constructs a new, empty XMLProperties with the specified defaults.

Parameters:
defaults - properties to use as the defaults.
 o XMLProperties
 public XMLProperties(InputStream input) throws XMLException, IOException
Constructs a new, empty XMLProperties from the given InputStream.

Parameters:
input - the XML source.
Throws: XMLException
if an XML error occurs.
Throws: IOException
if an IO error occurs.
 o XMLProperties
 public XMLProperties(InputStream input,
                      Properties defaults) throws XMLException, IOException
Constructs a new XMLProperties from the given InputStream with the specified defaults.

Parameters:
input - the XML source.
defaults - properties to use as the defaults.
Throws: XMLException
if an XML error occurs.
Throws: IOException
if an IO error occurs.

Methods

 o load
 public synchronized void load(InputStream input) throws XMLException, IOException
Loads the properties from the given InputStream.

Parameters:
input - the XML source.
Throws: XMLException
if an XML error occurs.
Throws: IOException
if an IO error occurs.
Overrides:
load in class Properties
 o save
 public synchronized void save(OutputStream output,
                               String header)
Saves the properties the the given OutputStream.

Parameters:
input - the XML source.
header - a comment to append to the start of the stream.
Throws: IOException
if an IO error occurs.
Overrides:
save in class Properties
 o main
 public static void main(String args[])
Quick test. Creates an empty XMLProperties, adds "foo":"bar" and "baz":"bah", saves to XMLProperties.xml, loads to a different instance and outputs to System.out.


All Packages  Class Hierarchy  This Package  Previous  Next  Index