Class ProxyContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.jackrabbit.commons.xml.ProxyContentHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
XmlnsContentHandler
public class ProxyContentHandler extends DefaultHandler
A proxy content handler that passes all SAX events as-is to the proxied handler.As a convenience this class inherits the
DefaultHandler
class instead of just theContentHandler
interface. This makes it possible to use this class as an adapter when using methods likeSAXParser.parse(String, DefaultHandler)
that expect a DefaultHandler instance instead of a ContentHandler.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHandler
handler
The proxied content handler.
-
Constructor Summary
Constructors Constructor Description ProxyContentHandler(ContentHandler handler)
Creates a proxy for the given content handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
Delegated tohandler
.void
endDocument()
Delegated tohandler
.void
endElement(String namespaceURI, String localName, String qName)
Delegated tohandler
.void
endPrefixMapping(String prefix)
Delegated tohandler
.void
ignorableWhitespace(char[] ch, int start, int length)
Delegated tohandler
.void
processingInstruction(String target, String data)
Delegated tohandler
.void
setDocumentLocator(Locator locator)
Delegated tohandler
.void
skippedEntity(String name)
Delegated tohandler
.void
startDocument()
Delegated tohandler
.void
startElement(String namespaceURI, String localName, String qName, Attributes atts)
Delegated tohandler
.void
startPrefixMapping(String prefix, String uri)
Delegated tohandler
.String
toString()
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
handler
protected ContentHandler handler
The proxied content handler. This is a protected, non-final field so that subclasses can access the proxied handler or even replace it they want.
-
-
Constructor Detail
-
ProxyContentHandler
public ProxyContentHandler(ContentHandler handler)
Creates a proxy for the given content handler.- Parameters:
handler
- content handler to be proxied
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
Delegated tohandler
.- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Parameters:
ch
- passed throughstart
- passed throughlength
- passed through- Throws:
SAXException
- if an error occurs
-
endDocument
public void endDocument() throws SAXException
Delegated tohandler
.- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classDefaultHandler
- Throws:
SAXException
- if an error occurs
-
endElement
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
Delegated tohandler
.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Parameters:
namespaceURI
- passed throughlocalName
- passed throughqName
- passed through- Throws:
SAXException
- if an error occurs
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
Delegated tohandler
.- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classDefaultHandler
- Parameters:
prefix
- passed through- Throws:
SAXException
- if an error occurs
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
Delegated tohandler
.- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Overrides:
ignorableWhitespace
in classDefaultHandler
- Parameters:
ch
- passed throughstart
- passed throughlength
- passed through- Throws:
SAXException
- if an error occurs
-
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
Delegated tohandler
.- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classDefaultHandler
- Parameters:
target
- passed throughdata
- passed through- Throws:
SAXException
- if an error occurs
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
Delegated tohandler
.- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classDefaultHandler
- Parameters:
locator
- passed through
-
skippedEntity
public void skippedEntity(String name) throws SAXException
Delegated tohandler
.- Specified by:
skippedEntity
in interfaceContentHandler
- Overrides:
skippedEntity
in classDefaultHandler
- Parameters:
name
- passed through- Throws:
SAXException
- if an error occurs
-
startDocument
public void startDocument() throws SAXException
Delegated tohandler
.- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
- Throws:
SAXException
- if an error occurs
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
Delegated tohandler
.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
namespaceURI
- passed throughlocalName
- passed throughqName
- passed throughatts
- passed through- Throws:
SAXException
- if an error occurs
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
Delegated tohandler
.- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classDefaultHandler
- Parameters:
prefix
- passed throughuri
- passed through- Throws:
SAXException
- if an error occurs
-
-