1 package com.thaiopensource.xml.sax; 2 3 import org.xml.sax.Locator ; 4 import org.xml.sax.SAXException ; 5 import org.xml.sax.Attributes ; 6 import org.xml.sax.ContentHandler ; 7 8 public class ForkContentHandler implements ContentHandler { 9 private final ContentHandler ch1; 10 private final ContentHandler ch2; 11 12 public ForkContentHandler(ContentHandler ch1, ContentHandler ch2) { 13 this.ch1 = ch1; 14 this.ch2 = ch2; 15 } 16 17 public void setDocumentLocator(Locator locator) { 18 ch1.setDocumentLocator(locator); 19 ch2.setDocumentLocator(locator); 20 } 21 22 public void startDocument() throws SAXException { 23 ch1.startDocument(); 24 ch2.startDocument(); 25 } 26 27 public void endDocument() throws SAXException { 28 ch1.endDocument(); 29 ch2.endDocument(); 30 } 31 32 public void startPrefixMapping(String s, String s1) throws SAXException { 33 ch1.startPrefixMapping(s, s1); 34 ch2.startPrefixMapping(s, s1); 35 } 36 37 public void endPrefixMapping(String s) throws SAXException { 38 ch1.endPrefixMapping(s); 39 ch2.endPrefixMapping(s); 40 } 41 42 public void startElement(String s, String s1, String s2, Attributes attributes) throws SAXException { 43 ch1.startElement(s, s1, s2, attributes); 44 ch2.startElement(s, s1, s2, attributes); 45 } 46 47 public void endElement(String s, String s1, String s2) throws SAXException { 48 ch1.endElement(s, s1, s2); 49 ch2.endElement(s, s1, s2); 50 } 51 52 public void characters(char[] chars, int i, int i1) throws SAXException { 53 ch1.characters(chars, i, i1); 54 ch2.characters(chars, i, i1); 55 } 56 57 public void ignorableWhitespace(char[] chars, int i, int i1) throws SAXException { 58 ch1.ignorableWhitespace(chars, i, i1); 59 ch2.ignorableWhitespace(chars, i, i1); 60 } 61 62 public void processingInstruction(String s, String s1) throws SAXException { 63 ch1.processingInstruction(s, s1); 64 ch2.processingInstruction(s, s1); 65 } 66 67 public void skippedEntity(String s) throws SAXException { 68 ch1.skippedEntity(s); 69 ch2.skippedEntity(s); 70 } 71 } 72 | Popular Tags |