1 16 package org.apache.cocoon.components.sax; 17 18 import org.apache.cocoon.xml.XMLConsumer; 19 import org.apache.cocoon.xml.XMLPipe; 20 import org.apache.cocoon.xml.XMLProducer; 21 import org.xml.sax.Attributes ; 22 import org.xml.sax.Locator ; 23 import org.xml.sax.SAXException ; 24 25 26 33 34 public final class XMLTeePipe 35 implements XMLPipe { 36 37 40 public void setConsumer(XMLConsumer consumer) { 41 ((XMLProducer)this.firstConsumer).setConsumer(consumer); 42 } 43 44 private XMLConsumer firstConsumer; 45 private XMLConsumer secondConsumer; 46 47 50 public XMLTeePipe(XMLConsumer firstPipe, 51 XMLConsumer secondConsumer) { 52 this.firstConsumer = firstPipe; 53 this.secondConsumer = secondConsumer; 54 } 55 56 public void recycle() { 57 this.firstConsumer = null; 58 this.secondConsumer = null; 59 } 60 61 public void startDocument() throws SAXException { 62 this.firstConsumer.startDocument(); 63 this.secondConsumer.startDocument(); 64 } 65 66 public void endDocument() throws SAXException { 67 this.firstConsumer.endDocument(); 68 this.secondConsumer.endDocument(); 69 } 70 71 public void startPrefixMapping(String prefix, String uri) throws SAXException { 72 this.firstConsumer.startPrefixMapping(prefix, uri); 73 this.secondConsumer.startPrefixMapping(prefix, uri); 74 } 75 76 public void endPrefixMapping(String prefix) throws SAXException { 77 this.firstConsumer.endPrefixMapping(prefix); 78 this.secondConsumer.endPrefixMapping(prefix); 79 } 80 81 public void startElement(String namespaceURI, String localName, String qName, Attributes atts) 82 throws SAXException { 83 this.firstConsumer.startElement(namespaceURI, localName, qName, atts); 84 this.secondConsumer.startElement(namespaceURI, localName, qName, atts); 85 } 86 87 public void endElement(String namespaceURI, String localName, String qName) 88 throws SAXException { 89 this.firstConsumer.endElement(namespaceURI, localName, qName); 90 this.secondConsumer.endElement(namespaceURI, localName, qName); 91 } 92 93 public void characters(char[] ch, int start, int length) throws SAXException { 94 this.firstConsumer.characters(ch, start, length); 95 this.secondConsumer.characters(ch, start, length); 96 } 97 98 public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { 99 this.firstConsumer.ignorableWhitespace(ch, start, length); 100 this.secondConsumer.ignorableWhitespace(ch, start, length); 101 } 102 103 public void processingInstruction(String target, String data) throws SAXException { 104 this.firstConsumer.processingInstruction(target, data); 105 this.secondConsumer.processingInstruction(target, data); 106 } 107 108 public void setDocumentLocator(Locator locator) { 109 this.firstConsumer.setDocumentLocator(locator); 110 this.secondConsumer.setDocumentLocator(locator); 111 } 112 113 public void skippedEntity(String name) throws SAXException { 114 this.firstConsumer.skippedEntity(name); 115 this.secondConsumer.skippedEntity(name); 116 } 117 118 public void startDTD(String name, String public_id, String system_id) 119 throws SAXException { 120 this.firstConsumer.startDTD(name, public_id, system_id); 121 this.secondConsumer.startDTD(name, public_id, system_id); 122 } 123 124 public void endDTD() throws SAXException { 125 this.firstConsumer.endDTD(); 126 this.secondConsumer.endDTD(); 127 } 128 129 public void startEntity(String name) throws SAXException { 130 this.firstConsumer.startEntity(name); 131 this.secondConsumer.startEntity(name); 132 } 133 134 public void endEntity(String name) throws SAXException { 135 this.firstConsumer.endEntity(name); 136 this.secondConsumer.endEntity(name); 137 } 138 139 public void startCDATA() throws SAXException { 140 this.firstConsumer.startCDATA(); 141 this.secondConsumer.startCDATA(); 142 } 143 144 public void endCDATA() throws SAXException { 145 this.firstConsumer.endCDATA(); 146 this.secondConsumer.endCDATA(); 147 } 148 149 public void comment(char ary[], int start, int length) 150 throws SAXException { 151 this.firstConsumer.comment(ary, start, length); 152 this.secondConsumer.comment(ary, start, length); 153 } 154 155 } 156 | Popular Tags |