public abstract class ConfigurationXMLReader extends Object implements XMLReader
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.
Modifier and Type | Field and Description |
---|---|
protected static String |
NS_URI
Constant for the namespace URI.
|
Modifier | Constructor and Description |
---|---|
protected |
ConfigurationXMLReader()
Creates a new instance of
ConfigurationXMLReader . |
Modifier and Type | Method and Description |
---|---|
protected void |
fireCharacters(String text)
Fires a SAX characters event.
|
protected void |
fireElementEnd(String name)
Fires a SAX element end event.
|
protected void |
fireElementStart(String name,
Attributes attribs)
Fires a SAX element start event.
|
ContentHandler |
getContentHandler()
Returns the actually set content handler.
|
DTDHandler |
getDTDHandler()
Returns the DTD handler.
|
EntityResolver |
getEntityResolver()
Returns the entity resolver.
|
ErrorHandler |
getErrorHandler()
Returns the error handler.
|
SAXException |
getException()
Returns a reference to an exception that occurred during parsing.
|
boolean |
getFeature(String name)
Dummy implementation of the interface method.
|
abstract Configuration |
getParsedConfiguration()
Returns a reference to the configuration that is parsed by this object.
|
Object |
getProperty(String name)
Dummy implementation of the interface method.
|
String |
getRootName()
Returns the name to be used for the root element.
|
void |
parse(InputSource input)
Parses the actual configuration object.
|
void |
parse(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(ContentHandler handler)
Sets the content handler.
|
void |
setDTDHandler(DTDHandler handler)
Sets the DTD handler.
|
void |
setEntityResolver(EntityResolver resolver)
Sets the entity resolver.
|
void |
setErrorHandler(ErrorHandler handler)
Sets the error handler.
|
void |
setFeature(String name,
boolean value)
Dummy implementation of the interface method.
|
void |
setProperty(String name,
Object value)
Dummy implementation of the interface method.
|
void |
setRootName(String string)
Sets the name for the root element.
|
protected static final String NS_URI
protected ConfigurationXMLReader()
ConfigurationXMLReader
.public void parse(String systemId) throws IOException, SAXException
parse
in interface XMLReader
systemId
- the system ID (ignored)IOException
- if no configuration was specifiedSAXException
- if an error occurs during parsingpublic void parse(InputSource input) throws IOException, SAXException
parse
in interface XMLReader
input
- the input source (ignored)IOException
- if no configuration was specifiedSAXException
- if an error occurs during parsingpublic boolean getFeature(String name)
getFeature
in interface XMLReader
name
- the name of the featurepublic void setFeature(String name, boolean value)
setFeature
in interface XMLReader
name
- the name of the feature to be setvalue
- the value of the featurepublic ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
public void setContentHandler(ContentHandler handler)
setContentHandler
in interface XMLReader
handler
- the content handlerpublic DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
public void setDTDHandler(DTDHandler handler)
setDTDHandler
in interface XMLReader
handler
- the handler to be setpublic EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
public void setEntityResolver(EntityResolver resolver)
setEntityResolver
in interface XMLReader
resolver
- the entity resolverpublic ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface XMLReader
handler
- the error handlerpublic Object getProperty(String name)
getProperty
in interface XMLReader
name
- the name of the requested propertypublic void setProperty(String name, Object value)
setProperty
in interface XMLReader
name
- the property namevalue
- the property valuepublic String getRootName()
public void setRootName(String string)
string
- the name for the root element.protected void fireElementStart(String name, Attributes attribs)
name
- the name of the actual elementattribs
- the attributes of this element (can be null)protected void fireElementEnd(String name)
name
- the name of the affected elementprotected void fireCharacters(String text)
text
- the textpublic SAXException getException()
protected void parseConfiguration() throws IOException, SAXException
IOException
- if no configuration has been specifiedSAXException
- if an error occurs during parsingpublic abstract Configuration getParsedConfiguration()
protected abstract void processKeys() throws IOException, 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.IOException
- if an IO error occursSAXException
- if a SAX error occursCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.