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
-
description
- Contains the description of the XMLProperties.
-
name
- Contains the name of the XMLProperties.
-
XMLProperties()
- Creates an empty property list.
-
getProperty(String)
- Searches for the property with the specified key in this property list.
-
getProperty(String, String)
- Searches for the property with the specified key in this property list.
-
list(PrintStream)
- Prints this property list out to the specified output stream.
-
list(PrintWriter)
- Prints this property list out to the specified output stream.
-
load(Document)
- Reads a property list from an input stream.
-
load(InputStream)
- Reads a property list from an input stream.
-
load(String)
- Reads a property list from an input stream.
-
propertyNames()
- Returns an enumeration of all the keys in this property list, including the keys in the default property list.
-
save()
- Stores this property list to the specified DOM document.
-
save(OutputStream)
- Stores this property list to the specified output stream according to the DTD.
-
save(OutputStream, XMLEncoding)
- Stores this property list to the specified output stream according to the DTD.
-
save(XMLEncoding)
- Stores this property list to the specified DOM document.
name
public String name
- Contains the name of the XMLProperties.
description
public String description
- Contains the description of the XMLProperties.
XMLProperties
public XMLProperties()
- Creates an empty property list.
load
public synchronized void load(InputStream in) throws IOException
- Reads a property list from an input stream.
- Parameters:
- in - The input stream.
load
public synchronized void load(String uri)
- Reads a property list from an input stream.
- Parameters:
- uri - The input uri.
load
public synchronized void load(Document document)
- Reads a property list from an input stream.
- Parameters:
- document - The input DOM document.
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.
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.
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.
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.
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.
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
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.
save
public synchronized Document save()
- Stores this property list to the specified DOM document.
- Returns:
- A DOM document.
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