1 16 package org.apache.cocoon.xml; 17 18 import org.xml.sax.ContentHandler ; 19 import org.xml.sax.SAXException ; 20 import org.xml.sax.ext.LexicalHandler ; 21 22 33 public class EmbeddedXMLPipe extends AbstractXMLPipe { 34 35 private boolean inDTD; 36 37 40 public EmbeddedXMLPipe(XMLConsumer consumer) { 41 setConsumer(consumer); 42 } 43 44 47 public EmbeddedXMLPipe(ContentHandler handler) { 48 setContentHandler(handler); 49 if (handler instanceof LexicalHandler ) { 50 setLexicalHandler((LexicalHandler ) handler); 51 } 52 } 53 54 57 public EmbeddedXMLPipe(ContentHandler contentHandler, LexicalHandler lexicalHandler) { 58 setContentHandler(contentHandler); 59 setLexicalHandler(lexicalHandler); 60 } 61 62 67 public void startDocument() throws SAXException { 68 } 69 70 75 public void endDocument() throws SAXException { 76 } 77 78 83 public void startDTD(String name, String publicId, String systemId) 84 throws SAXException { 85 this.inDTD = true; 87 } 88 89 94 public void endDTD() throws SAXException { 95 this.inDTD = false; 97 } 98 99 105 public void comment(char ch[], int start, int len) 106 throws SAXException { 107 if (!inDTD) { 108 super.comment(ch, start, len); 109 } 110 } 111 } 112 | Popular Tags |