org.apache.cocoon.xml.sax
Class EmbeddedSAXPipe

java.lang.Object
  extended by org.apache.cocoon.xml.sax.AbstractSAXProducer
      extended by org.apache.cocoon.xml.sax.AbstractSAXPipe
          extended by org.apache.cocoon.xml.sax.EmbeddedSAXPipe
All Implemented Interfaces:
ContentHandler, LexicalHandler

public class EmbeddedSAXPipe
extends AbstractSAXPipe

This class implements a ContentHandler for embedding a full SAX event stream into an existing stream of SAX events. An instance of this class will pass unmodified all the SAX events to the linked ContentHandler, but it will ignore the startDocument/endDocument and startDTD/endDTD events, as well as all comment events within the DTD.

Version:
$Id: EmbeddedSAXPipe.java 729283 2008-12-24 09:25:21Z cziegeler $

Field Summary
 
Fields inherited from class org.apache.cocoon.xml.sax.AbstractSAXProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler
 
Constructor Summary
EmbeddedSAXPipe(ContentHandler handler)
          Creates an EmbeddedXMLPipe that writes into the given ContentHandler.
 
Method Summary
 void comment(char[] ch, int start, int len)
          Ignore all comment events if between startDTD/endDTD events.
 void endDocument()
          Ignore the endDocument event: this method does nothing.
 void endDTD()
          Ignore the endDTD event: this method does nothing.
 void startDocument()
          Ignore the startDocument event: this method does nothing.
 void startDTD(String name, String publicId, String systemId)
          Ignore the startDTD event: this method does nothing.
 
Methods inherited from class org.apache.cocoon.xml.sax.AbstractSAXPipe
characters, endCDATA, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.sax.AbstractSAXProducer
recycle, setContentHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedSAXPipe

public EmbeddedSAXPipe(ContentHandler handler)
Creates an EmbeddedXMLPipe that writes into the given ContentHandler.

Method Detail

startDocument

public void startDocument()
                   throws SAXException
Ignore the startDocument event: this method does nothing.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class AbstractSAXPipe
Throws:
SAXException - if an error occurs

endDocument

public void endDocument()
                 throws SAXException
Ignore the endDocument event: this method does nothing.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class AbstractSAXPipe
Throws:
SAXException - if an error occurs

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Ignore the startDTD event: this method does nothing.

Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in class AbstractSAXPipe
Parameters:
name - The document type name.
publicId - The declared public identifier for the external DTD subset, or null if none was declared.
systemId - The declared system identifier for the external DTD subset, or null if none was declared.
Throws:
SAXException - if an error occurs

endDTD

public void endDTD()
            throws SAXException
Ignore the endDTD event: this method does nothing.

Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in class AbstractSAXPipe
Throws:
SAXException - if an error occurs

comment

public void comment(char[] ch,
                    int start,
                    int len)
             throws SAXException
Ignore all comment events if between startDTD/endDTD events.

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class AbstractSAXPipe
Parameters:
ch - An array holding the characters in the comment.
start - The starting position in the array.
len - The number of characters to use from the array.
Throws:
SAXException - if an error occurs


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