org.mmbase.util
Class XMLProperties

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended byorg.mmbase.util.XMLProperties
All Implemented Interfaces:
java.lang.Cloneable, org.xml.sax.ContentHandler, java.util.Map, java.io.Serializable

public class XMLProperties
extends java.util.Properties
implements org.xml.sax.ContentHandler

This is a flexible Properties version, it can handle saving of Properties with the comments that will stay in your file.

Version:
$Id: XMLProperties.java,v 1.5 2003/07/07 13:35:21 keesj Exp $
Author:
Jan van Oosterom
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
XMLProperties()
           
 
Method Summary
 void characters(char[] ch, int start, int len)
          Receive notification of character data.
 void endDocument()
          Receive notification of the end of a document.
 void endElement(java.lang.String uri, java.lang.String loc, java.lang.String raw)
          Receive notification of the end of an element.
 void endPrefixMapping(java.lang.String p)
          End the scope of a prefix-URI mapping.
 java.util.Hashtable getProperties()
          Read from Properties and return them.
static XMLProperties getPropertiesFromXML(java.lang.String file)
          Read an XML file in which key/value pairs are represented as tag and content
 void ignorableWhitespace(char[] ch, int start, int len)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Receive an object for locating the origin of SAX document events.
 void skippedEntity(java.lang.String name)
          Receive notification of a skipped entity.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(java.lang.String uri, java.lang.String loc, java.lang.String raw, org.xml.sax.Attributes a)
          Receive notification of the beginning of an element.
 void startPrefixMapping(java.lang.String p, java.lang.String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLProperties

public XMLProperties()
Method Detail

getProperties

public java.util.Hashtable getProperties()
Read from Properties and return them.


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of a document.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of a document.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String p,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Begin the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String p)
                      throws org.xml.sax.SAXException
End the scope of a prefix-URI mapping.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String loc,
                         java.lang.String raw,
                         org.xml.sax.Attributes a)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String loc,
                       java.lang.String raw)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int len)
Receive notification of character data.

Specified by:
characters in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int len)
Receive notification of ignorable whitespace in element content.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Receive notification of a processing instruction.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Receive notification of a skipped entity.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

getPropertiesFromXML

public static XMLProperties getPropertiesFromXML(java.lang.String file)
Read an XML file in which key/value pairs are represented as tag and content

Returns:
Hashtable with the key/value pairs or an empty Hashtable if something went wrong.


MMBase build 1.7.1.20041002