Class fr.bizolin.xml.XMLProperties
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class fr.bizolin.xml.XMLProperties

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----fr.bizolin.xml.XMLProperties

public class XMLProperties
extends Hashtable
XMLProperties by Bizolin (c)Cyril Vincent
www.multimania.com/cvincent/
March 2000
The XMLProperties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream.
Each key and its corresponding value in the property list are stored in a XML document. A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list.

DTD :
<!ELEMENT xmlproperties (properties)>
<!ELEMENT properties (property)*>
<!ATTLIST properties name CDATA #REQUIRED language CDATA 'en' description CDATA #IMPLIED>
<!ELEMENT property (#PCDATA )>
<!ATTLIST property name CDATA #REQUIRED>

Sample :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE xmlproperties SYSTEM "xmlproperties.dtd">
<xmlproperties>
<properties name="sample" language="en" description="sample">
<property name="firstname">Cyril</property>
<property name="lastname">Vincent</property>
<property name="url">www.multimania.com/cvincent</property>
<property name="mail">cyril.vincent@usa.net</property>
</properties>
</xmlproperties>

This class needs the org.w3c.dom and oracle.xml.parser.v2 packages.

Version:
0.1.000324
Author:
Cyril Vincent

Variable Index

 o description
Contains the description of the XMLProperties.
 o name
Contains the name of the XMLProperties.

Constructor Index

 o XMLProperties()
Creates an empty property list.

Method Index

 o getProperty(String)
Searches for the property with the specified key in this property list.
 o getProperty(String, String)
Searches for the property with the specified key in this property list.
 o list(PrintStream)
Prints this property list out to the specified output stream.
 o list(PrintWriter)
Prints this property list out to the specified output stream.
 o load(Document)
Reads a property list from an input stream.
 o load(InputStream)
Reads a property list from an input stream.
 o load(String)
Reads a property list from an input stream.
 o propertyNames()
Returns an enumeration of all the keys in this property list, including the keys in the default property list.
 o save()
Stores this property list to the specified DOM document.
 o save(OutputStream)
Stores this property list to the specified output stream according to the DTD.
 o save(OutputStream, XMLEncoding)
Stores this property list to the specified output stream according to the DTD.
 o save(XMLEncoding)
Stores this property list to the specified DOM document.

Variables

 o name
 public String name
Contains the name of the XMLProperties.

 o description
 public String description
Contains the description of the XMLProperties.

Constructors

 o XMLProperties
 public XMLProperties()
Creates an empty property list.

Methods

 o load
 public synchronized void load(InputStream in) throws IOException
Reads a property list from an input stream.

Parameters:
in - The input stream.
 o load
 public synchronized void load(String uri)
Reads a property list from an input stream.

Parameters:
uri - The input uri.
 o load
 public synchronized void load(Document document)
Reads a property list from an input stream.

Parameters:
document - The input DOM document.
 o getProperty
 public String getProperty(String key)
Searches for the property with the specified key in this property list. The method returns null if the property is not found.

Parameters:
key - The property key.
Returns:
The value in this property list with the specified key value.
 o getProperty
 public String getProperty(String key,
                           String defaultValue)
Searches for the property with the specified key in this property list. The method returns the default value argument if the property is not found.

Parameters:
key - The property key.
defaultValue - A default value.
Returns:
The value in this property list with the specified key value.
 o list
 public void list(PrintStream out)
Prints this property list out to the specified output stream. This method is useful for debugging.

Parameters:
out - An output stream.
 o list
 public void list(PrintWriter out)
Prints this property list out to the specified output stream. This method is useful for debugging.

Parameters:
out - An output stream.
 o propertyNames
 public Enumeration propertyNames()
Returns an enumeration of all the keys in this property list, including the keys in the default property list.

Returns:
an enumeration of all the keys in this property list, including the keys in the default property list.
 o save
 public synchronized void save(OutputStream out,
                               XMLEncoding encoding)
Stores this property list to the specified output stream according to the DTD.

Parameters:
out - An output stream.
encoding - The encoding
 o save
 public synchronized void save(OutputStream out)
Stores this property list to the specified output stream according to the DTD.

Parameters:
out - An output stream.
 o save
 public synchronized Document save()
Stores this property list to the specified DOM document.

Returns:
A DOM document.
 o save
 public synchronized Document save(XMLEncoding encoding)
Stores this property list to the specified DOM document.

Parameters:
encoding - The encoding
Returns:
A DOM document.

All Packages  Class Hierarchy  This Package  Previous  Next  Index