Arch4J 1.1

org.arch4j.property
Class XMLPropertyReader

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.arch4j.property.XMLPropertyReader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, PropertyConstants

public class XMLPropertyReader
extends org.xml.sax.helpers.DefaultHandler
implements PropertyConstants

This class is used to parse (read) an XML-based property file.

JAXP and SAX parsing is configured locally, so there is no dependence on other frameworks until property management (of which this class is a part) is fully started.

A non-validating parser is used; the property file format is simple enough to validate each property on the fly. In the future a DTD could be written and the file validated against it while parsing.

Version:
$Revision: 1.3 $
Author:
Ross E. Greinke

Field Summary
 
Fields inherited from interface org.arch4j.property.PropertyConstants
ADD_STRING, BOOLEAN_CHAR, BOOLEAN_NAME, CHAR_CHAR, CHAR_NAME, DEFAULT_DOMAIN_NAME, DOMAIN_CHAR, DOMAIN_TAG_NAME, DOUBLE_CHAR, DOUBLE_NAME, EMPTY_STRING, FALSE_STRING, FLOAT_CHAR, FLOAT_NAME, INT_CHAR, INT_NAME, KEY_CHAR, KEY_TAG_NAME, LONG_CHAR, LONG_NAME, NAME_CHAR, NAME_TAG_NAME, PROPERTY_CHAR, PROPERTY_TAG_NAME, STRING_CHAR, STRING_NAME, TOP_LEVEL_CHAR, TOP_LEVEL_TAG_NAME, TRUE_STRING, TYPE_CHAR, TYPE_TAG_NAME, VALUE_CHAR, VALUE_TAG_NAME, XML_DECLARATION
 
Constructor Summary
XMLPropertyReader(Map properties, File propertyFile)
          Constructs a XMLPropertyReader, which will be used to parse the given property file into the property map.
 
Method Summary
 void endElement(String uri, String localName, String qName)
          Receive notification of the end of an element.
 void load()
          Parse and load the properties.
 void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attributes)
          Receive notification of the start of an element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLPropertyReader

public XMLPropertyReader(Map properties,
                         File propertyFile)
Constructs a XMLPropertyReader, which will be used to parse the given property file into the property map.

Parameters:
properties - The property map to fill in.
propertyFile - The XML property file to parse.
Method Detail

load

public void load()
Parse and load the properties.


startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The namespace URI
localName - The element type name.
qName - The qualified name.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The namespace URI
localName - The element type name.
qName - The qualified name.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.