|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.ConfigurationXMLReader
public abstract class ConfigurationXMLReader
A base class for "faked" XMLReader classes
that transform a configuration object in a set of SAX parsing events.
This class provides dummy implementations for most of the methods
defined in the XMLReader interface that are not used for this
special purpose. There will be concrete sub classes that process specific
configuration classes.
| Field Summary | |
|---|---|
private org.xml.sax.ContentHandler |
contentHandler
Stores the content handler. |
private static java.lang.String |
DEFAULT_ROOT_NAME
Constant for the default name of the root element. |
private static org.xml.sax.Attributes |
EMPTY_ATTRS
An empty attributes object. |
private org.xml.sax.SAXException |
exception
Stores an exception that occurred during parsing. |
protected static java.lang.String |
NS_URI
Constant for the namespace URI. |
private java.lang.String |
rootName
Stores the name for the root element. |
| Constructor Summary | |
|---|---|
protected |
ConfigurationXMLReader()
Creates a new instance of ConfigurationXMLReader. |
| Method Summary | |
|---|---|
protected void |
fireCharacters(java.lang.String text)
Fires a SAX characters event. |
protected void |
fireElementEnd(java.lang.String name)
Fires a SAX element end event. |
protected void |
fireElementStart(java.lang.String name,
org.xml.sax.Attributes attribs)
Fires a SAX element start event. |
org.xml.sax.ContentHandler |
getContentHandler()
Returns the actually set content handler. |
org.xml.sax.DTDHandler |
getDTDHandler()
Returns the DTD handler. |
org.xml.sax.EntityResolver |
getEntityResolver()
Returns the entity resolver. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Returns the error handler. |
org.xml.sax.SAXException |
getException()
Returns a reference to an exception that occurred during parsing. |
boolean |
getFeature(java.lang.String name)
Dummy implementation of the interface method. |
abstract Configuration |
getParsedConfiguration()
Returns a reference to the configuration that is parsed by this object. |
java.lang.Object |
getProperty(java.lang.String name)
Dummy implementation of the interface method. |
java.lang.String |
getRootName()
Returns the name to be used for the root element. |
void |
parse(org.xml.sax.InputSource input)
Parses the acutal configuration object. |
void |
parse(java.lang.String systemId)
Parses the acutal configuration object. |
protected void |
parseConfiguration()
Parses the configuration object and generates SAX events. |
protected abstract void |
processKeys()
Processes all keys stored in the actual configuration. |
void |
setContentHandler(org.xml.sax.ContentHandler handler)
Sets the content handler. |
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Sets the DTD handler. |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Sets the entity resolver. |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Sets the error handler. |
void |
setFeature(java.lang.String name,
boolean value)
Dummy implementation of the interface method. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Dummy implementation of the interface method. |
void |
setRootName(java.lang.String string)
Sets the name for the root element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String NS_URI
private static final java.lang.String DEFAULT_ROOT_NAME
private static final org.xml.sax.Attributes EMPTY_ATTRS
private org.xml.sax.ContentHandler contentHandler
private org.xml.sax.SAXException exception
private java.lang.String rootName
| Constructor Detail |
|---|
protected ConfigurationXMLReader()
ConfigurationXMLReader.
| Method Detail |
|---|
public void parse(java.lang.String systemId)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReadersystemId - the system ID (ignored)
java.io.IOException - if no configuration was specified
org.xml.sax.SAXException - if an error occurs during parsing
public void parse(org.xml.sax.InputSource input)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReaderinput - the input source (ignored)
java.io.IOException - if no configuration was specified
org.xml.sax.SAXException - if an error occurs during parsingpublic boolean getFeature(java.lang.String name)
getFeature in interface org.xml.sax.XMLReadername - the name of the feature
public void setFeature(java.lang.String name,
boolean value)
setFeature in interface org.xml.sax.XMLReadername - the name of the feature to be setvalue - the value of the featurepublic org.xml.sax.ContentHandler getContentHandler()
getContentHandler in interface org.xml.sax.XMLReaderpublic void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler in interface org.xml.sax.XMLReaderhandler - the content handlerpublic org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler in interface org.xml.sax.XMLReaderpublic void setDTDHandler(org.xml.sax.DTDHandler handler)
setDTDHandler in interface org.xml.sax.XMLReaderhandler - the handler to be setpublic org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver in interface org.xml.sax.XMLReaderpublic void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver in interface org.xml.sax.XMLReaderresolver - the entity resolverpublic org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler in interface org.xml.sax.XMLReaderpublic void setErrorHandler(org.xml.sax.ErrorHandler handler)
setErrorHandler in interface org.xml.sax.XMLReaderhandler - the error handlerpublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface org.xml.sax.XMLReadername - the name of the requested property
public void setProperty(java.lang.String name,
java.lang.Object value)
setProperty in interface org.xml.sax.XMLReadername - the property namevalue - the property valuepublic java.lang.String getRootName()
public void setRootName(java.lang.String string)
string - the name for the root element.
protected void fireElementStart(java.lang.String name,
org.xml.sax.Attributes attribs)
name - the name of the actual elementattribs - the attributes of this element (can be null)protected void fireElementEnd(java.lang.String name)
name - the name of the affected elementprotected void fireCharacters(java.lang.String text)
text - the textpublic org.xml.sax.SAXException getException()
protected void parseConfiguration()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException - if no configuration has been specified
org.xml.sax.SAXException - if an error occurs during parsingpublic abstract Configuration getParsedConfiguration()
protected abstract void processKeys()
throws java.io.IOException,
org.xml.sax.SAXException
parseConfiguration() to start the main parsing
process. parseConfiguration() calls the content handler's
startDocument() and endElement() methods
and cares for exception handling. The remaining actions are left to this
method that must be implemented in a concrete sub class.
java.io.IOException - if an IO error occurs
org.xml.sax.SAXException - if a SAX error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||