org.apache.cocoon.xml
Class DocumentHandlerAdapter

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.DocumentHandlerAdapter
All Implemented Interfaces:
Poolable, Recyclable, LogEnabled, XMLProducer, DocumentHandler

public class DocumentHandlerAdapter
extends AbstractXMLProducer
implements DocumentHandler

This class is an utility class "adapting" a SAX version 1.0 DocumentHandler, to SAX version 2 ContentHandler.
This class fully supports XML namespaces, converting xmlns and xmlns:... element attributes into appropriate startPrefixMapping(...) and endPrefixMapping(...) calls.

Version:
CVS $Id: DocumentHandlerAdapter.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Pierpaolo Fumagalli (Apache Software Foundation)

Field Summary
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Constructor Summary
DocumentHandlerAdapter()
          Create a new DocumentHandlerAdapter instance.
DocumentHandlerAdapter(ContentHandler content)
          Create a new DocumentHandlerAdapter instance.
DocumentHandlerAdapter(XMLConsumer consumer)
          Create a new DocumentHandlerAdapter instance.
 
Method Summary
 void characters(char[] ch, int start, int len)
          Receive notification of character data.
 void endDocument()
          Receive notification of the end of a document.
 void endElement(String name)
          Receive notification of the end of an element.
 void ignorableWhitespace(char[] ch, int start, int len)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(String target, String data)
          Receive notification of a processing instruction.
 void setDocumentLocator(Locator locator)
          Receive an object for locating the origin of SAX document events.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(String name, AttributeList a)
          Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle, setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentHandlerAdapter

public DocumentHandlerAdapter()
Create a new DocumentHandlerAdapter instance.


DocumentHandlerAdapter

public DocumentHandlerAdapter(XMLConsumer consumer)
Create a new DocumentHandlerAdapter instance.


DocumentHandlerAdapter

public DocumentHandlerAdapter(ContentHandler content)
Create a new DocumentHandlerAdapter instance.

Method Detail

setDocumentLocator

public void setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface DocumentHandler

startDocument

public void startDocument()
                   throws SAXException
Receive notification of the beginning of a document.

Specified by:
startDocument in interface DocumentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Receive notification of the end of a document.

Specified by:
endDocument in interface DocumentHandler
Throws:
SAXException

startElement

public void startElement(String name,
                         AttributeList a)
                  throws SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface DocumentHandler
Throws:
SAXException

endElement

public void endElement(String name)
                throws SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface DocumentHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int len)
                throws SAXException
Receive notification of character data.

Specified by:
characters in interface DocumentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int len)
                         throws SAXException
Receive notification of ignorable whitespace in element content.

Specified by:
ignorableWhitespace in interface DocumentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Receive notification of a processing instruction.

Specified by:
processingInstruction in interface DocumentHandler
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.