Configurations from XML,
via a SAX2 compliant parser.
XML namespace support is optional, and disabled by default to preserve
backwards-compatibility. To enable it, pass the DefaultConfigurationBuilder(boolean) constructor the flag true, or pass
a namespace-enabled XMLReader to the DefaultConfigurationBuilder(XMLReader) constructor.
The mapping from XML namespaces to Configuration namespaces is pretty
straightforward, with one caveat: attribute namespaces are (deliberately) not
supported. Enabling namespace processing has the following effects:
xmlns: are interpreted as
declaring a prefix:namespaceURI mapping, and won't result in the creation of
xmlns-prefixed attributes in the Configuration.
Configuration with getName().equals("title") and getNamespace().equals("http://foo.com").
Whitespace handling. Since mixed content is not allowed in the
configurations, whitespace is completely discarded in non-leaf nodes.
For the leaf nodes the default behavior is to trim the space
surrounding the value. This can be changed by specifying
xml:space attribute with value of preserve
in that case the whitespace is left intact.
| Modifier and Type | Field and Description |
|---|---|
| private SAXConfigurationHandler | |
| private XMLReader |
| Access | Constructor and Description |
|---|---|
| public | DefaultConfigurationBuilder()
Create a Configuration Builder with a default XMLReader that ignores namespaces. |
| public | DefaultConfigurationBuilder(final boolean
If enableNamespaces)true, a namespace-aware
SAXParser is used. If false, the default JAXP
SAXParser (without namespace support) is used.Create a Configuration Builder, specifying a flag that determines namespace support. |
| public | DefaultConfigurationBuilder(XMLReader
an parser)XMLReaderCreate a Configuration Builder with your own XMLReader. |
| Modifier and Type | Method and Description |
|---|---|
| public Configuration | Returns: aConfiguration objectan inputStream)InputStream valueBuild a configuration object using an InputStream. |
| public Configuration | Returns: aConfiguration objectan inputStream, final String InputStream valuethe systemId to set on the intermediate sax
inputSource systemId)Build a configuration object using an InputStream; supplying a systemId to make messages about all kinds of errors more meaningfull. |
| public Configuration | |
| public Configuration | Returns: aConfiguration objectan input)InputSource valueBuild a configuration object using an XML InputSource object |
| public Configuration | Returns: aConfiguration objectname of the file filename)Build a configuration object from a file using a filename. |
| public Configuration | Returns: aConfiguration objecta file)File objectBuild a configuration object from a file using a File object. |
| protected SAXConfigurationHandler | Returns: aSAXConfigurationHandlerGet a SAXConfigurationHandler for your configuration reading. |
| public void | setEntityResolver(final EntityResolver
implementation of resolver)EntityResolverSets the |
| private void |
| m_handler | back to summary |
|---|---|
| private SAXConfigurationHandler m_handler | |
| m_parser | back to summary |
|---|---|
| private XMLReader m_parser | |
| DefaultConfigurationBuilder | back to summary |
|---|---|
| public DefaultConfigurationBuilder() Create a Configuration Builder with a default XMLReader that ignores namespaces. In order to enable namespaces, use either the constructor that has a boolean or that allows you to pass in your own namespace-enabled XMLReader. | |
| DefaultConfigurationBuilder | back to summary |
|---|---|
| public DefaultConfigurationBuilder(final boolean enableNamespaces) Create a Configuration Builder, specifying a flag that determines namespace support.
| |
| DefaultConfigurationBuilder | back to summary |
|---|---|
| public DefaultConfigurationBuilder(XMLReader parser) Create a Configuration Builder with your own XMLReader.
| |
| build | back to summary |
|---|---|
| public Configuration build(final InputStream inputStream) throws SAXException, IOException, ConfigurationException Build a configuration object using an InputStream.
| |
| build | back to summary |
|---|---|
| public Configuration build(final InputStream inputStream, final String systemId) throws SAXException, IOException, ConfigurationException Build a configuration object using an InputStream; supplying a systemId to make messages about all kinds of errors more meaningfull.
| |
| build | back to summary |
|---|---|
| public Configuration build(final String uri) throws SAXException, IOException, ConfigurationException Build a configuration object using an URI
| |
| build | back to summary |
|---|---|
| public Configuration build(final InputSource input) throws SAXException, IOException, ConfigurationException Build a configuration object using an XML InputSource object
| |
| buildFromFile | back to summary |
|---|---|
| public Configuration buildFromFile(final String filename) throws SAXException, IOException, ConfigurationException Build a configuration object from a file using a filename.
| |
| buildFromFile | back to summary |
|---|---|
| public Configuration buildFromFile(final File file) throws SAXException, IOException, ConfigurationException Build a configuration object from a file using a File object.
| |
| getHandler | back to summary |
|---|---|
| protected SAXConfigurationHandler getHandler() Get a SAXConfigurationHandler for your configuration reading.
| |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(final EntityResolver resolver) Sets the
| |
| setParser | back to summary |
|---|---|
| private void setParser(XMLReader parser) Internally sets up the XMLReader | |