org.apache.cocoon.xml
Class DocumentHandlerAdapter

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLProducer
              |
              +--org.apache.cocoon.xml.DocumentHandlerAdapter
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, XMLProducer

public class DocumentHandlerAdapter
extends AbstractXMLProducer
implements org.xml.sax.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.java,v 1.4 2002/02/22 07:03:58 cziegeler Exp $
Author:
Pierpaolo Fumagalli (Apache Software Foundation, Exoffice Technologies)

Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Constructor Summary
DocumentHandlerAdapter()
          Create a new DocumentHandlerAdapter instance.
DocumentHandlerAdapter(org.xml.sax.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(java.lang.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(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void setDocumentLocator(org.xml.sax.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(java.lang.String name, org.xml.sax.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.AbstractLoggable
getLogger, setLogger, 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(org.xml.sax.ContentHandler content)
Create a new DocumentHandlerAdapter instance.
Method Detail

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events.
Specified by:
setDocumentLocator in interface org.xml.sax.DocumentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of a document.
Specified by:
startDocument in interface org.xml.sax.DocumentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of a document.
Specified by:
endDocument in interface org.xml.sax.DocumentHandler

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList a)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.
Specified by:
startElement in interface org.xml.sax.DocumentHandler

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.
Specified by:
endElement in interface org.xml.sax.DocumentHandler

characters

public void characters(char[] ch,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Receive notification of character data.
Specified by:
characters in interface org.xml.sax.DocumentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int len)
                         throws org.xml.sax.SAXException
Receive notification of ignorable whitespace in element content.
Specified by:
ignorableWhitespace in interface org.xml.sax.DocumentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Receive notification of a processing instruction.
Specified by:
processingInstruction in interface org.xml.sax.DocumentHandler


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.