Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.cocoon.xml.sax;
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 $
public class EmbeddedSAXPipe extends AbstractSAXPipe {
    private boolean inDTD;

    
Creates an EmbeddedXMLPipe that writes into the given ContentHandler.
    public EmbeddedSAXPipe(ContentHandler handler) {
        setContentHandler(handler);
    }

    
Ignore the startDocument event: this method does nothing.

Throws:
org.xml.sax.SAXException if an error occurs
    public void startDocument() throws SAXException {
    }

    
Ignore the endDocument event: this method does nothing.

Throws:
org.xml.sax.SAXException if an error occurs
    public void endDocument() throws SAXException {
    }

    
Ignore the startDTD event: this method does nothing.

Throws:
org.xml.sax.SAXException if an error occurs
    public void startDTD(String nameString publicIdString systemId)
    throws SAXException {
        // Ignored
        this. = true;
    }

    
Ignore the endDTD event: this method does nothing.

Throws:
org.xml.sax.SAXException if an error occurs
    public void endDTD() throws SAXException {
        // Ignored
        this. = false;
    }

    
Ignore all comment events if between startDTD/endDTD events.

Throws:
org.xml.sax.SAXException if an error occurs
    public void comment(char ch[], int startint len)
    throws SAXException {
        if (!) {
            super.comment(chstartlen);
        }
    }
New to GrepCode? Check out our FAQ X