KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > xml > sax > ForkContentHandler


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