org.apache.cocoon.xml
Class DocumentHandlerAdapter

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.DocumentHandlerAdapter
All Implemented Interfaces:
DocumentHandler, Poolable, Recyclable, org.apache.cocoon.xml.XMLProducer

public class DocumentHandlerAdapter
extends org.apache.cocoon.xml.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:
$Id: DocumentHandlerAdapter.html 1304280 2012-03-23 11:18:01Z ilgrosso $

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(org.apache.cocoon.xml.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.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
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(org.apache.cocoon.xml.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-2008 The Apache Software Foundation. All Rights Reserved.