|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.apache.cocoon.configuration.ConfigurationBuilder
A ConfigurationBuilder builds Configuration
s from XML,
via a SAX2 compliant parser.
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.
Constructor Summary | |
ConfigurationBuilder(Settings s)
Create a Configuration Builder |
Method Summary | |
Configuration |
build(InputSource input)
Build a configuration object using an XML InputSource object |
Configuration |
build(InputStream inputStream)
Build a configuration object using an InputStream. |
Configuration |
build(InputStream inputStream,
String systemId)
Build a configuration object using an InputStream; supplying a systemId to make messages about all kinds of errors more meaningfull. |
Configuration |
build(String uri)
Build a configuration object using an URI |
void |
characters(char[] ch,
int start,
int end)
|
protected void |
clear()
Clears all data from this configuration handler. |
protected DefaultConfiguration |
createConfiguration(String localName,
String namespaceURI,
String location)
Create a new DefaultConfiguration with the specified
local name, namespace, and location. |
void |
endDocument()
|
void |
endElement(String namespaceURI,
String localName,
String rawName)
|
void |
error(SAXParseException exception)
|
void |
fatalError(SAXParseException exception)
|
void |
setDocumentLocator(Locator locator)
|
void |
setEntityResolver(EntityResolver resolver)
Sets the EntityResolver to
be used by parser. |
void |
startDocument()
|
void |
startElement(String namespaceURI,
String localName,
String rawName,
Attributes attributes)
|
void |
startPrefixMapping(String prefix,
String uri)
|
void |
warning(SAXParseException exception)
|
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConfigurationBuilder(Settings s)
Method Detail |
public Configuration build(InputStream inputStream) throws SAXException, IOException
inputStream
- an InputStream
value
Configuration
object
SAXException
- if a parsing error occurs
IOException
- if an I/O error occurspublic Configuration build(InputStream inputStream, String systemId) throws SAXException, IOException
inputStream
- an InputStream
valuesystemId
- the systemId to set on the intermediate sax
inputSource
Configuration
object
SAXException
- if a parsing error occurs
IOException
- if an I/O error occurspublic Configuration build(String uri) throws SAXException, IOException
uri
- a String
value
Configuration
object
SAXException
- if a parsing error occurs
IOException
- if an I/O error occurspublic Configuration build(InputSource input) throws SAXException, IOException
input
- an InputSource
value
Configuration
object
SAXException
- if a parsing error occurs
IOException
- if an I/O error occurspublic void setEntityResolver(EntityResolver resolver)
EntityResolver
to
be used by parser. Useful when dealing with xml
files that reference external entities.
resolver
- implementation of EntityResolver
protected void clear()
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
public void characters(char[] ch, int start, int end) throws SAXException
characters
in interface ContentHandler
SAXException
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException
endElement
in interface ContentHandler
SAXException
protected DefaultConfiguration createConfiguration(String localName, String namespaceURI, String location)
DefaultConfiguration
with the specified
local name, namespace, and location.
localName
- a String
valuenamespaceURI
- a String
valuelocation
- a String
value
DefaultConfiguration
valuepublic void startElement(String namespaceURI, String localName, String rawName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
SAXException
public void error(SAXParseException exception) throws SAXException
error
in interface ErrorHandler
SAXException
public void warning(SAXParseException exception) throws SAXException
warning
in interface ErrorHandler
SAXException
public void fatalError(SAXParseException exception) throws SAXException
fatalError
in interface ErrorHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
SAXException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |