org.apache.cocoon.xml
Class EmbeddedXMLPipe

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.xml.EmbeddedXMLPipe
All Implemented Interfaces:
ContentHandler, LexicalHandler, Poolable, Recyclable, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class EmbeddedXMLPipe
extends AbstractXMLPipe

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: EmbeddedXMLPipe.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
EmbeddedXMLPipe(ContentHandler handler)
          Creates an EmbeddedXMLPipe that writes into the given ContentHandler.
EmbeddedXMLPipe(ContentHandler contentHandler, LexicalHandler lexicalHandler)
          Creates an EmbeddedXMLPipe that writes into the given ContentHandler.
EmbeddedXMLPipe(org.apache.cocoon.xml.XMLConsumer consumer)
          Creates an EmbeddedXMLPipe that writes into the given XMLConsumer.
 
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.AbstractXMLPipe
characters, endCDATA, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startElement, startEntity, startPrefixMapping
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

EmbeddedXMLPipe

public EmbeddedXMLPipe(org.apache.cocoon.xml.XMLConsumer consumer)
Creates an EmbeddedXMLPipe that writes into the given XMLConsumer.


EmbeddedXMLPipe

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


EmbeddedXMLPipe

public EmbeddedXMLPipe(ContentHandler contentHandler,
                       LexicalHandler lexicalHandler)
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 AbstractXMLPipe
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 AbstractXMLPipe
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 AbstractXMLPipe
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 AbstractXMLPipe
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 AbstractXMLPipe
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-2008 The Apache Software Foundation. All Rights Reserved.