1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.tika.sax;
18
19 import org.xml.sax.Attributes;
20 import org.xml.sax.ContentHandler;
21 import org.xml.sax.Locator;
22 import org.xml.sax.SAXException;
23
24
25
26
27
28 public class TeeContentHandler extends ContentHandlerDecorator {
29
30 private final ContentHandler branch;
31
32 public TeeContentHandler(ContentHandler handler, ContentHandler branch) {
33 super(handler);
34 this.branch = branch;
35 }
36
37 public void startPrefixMapping(String prefix, String uri)
38 throws SAXException {
39 super.startPrefixMapping(prefix, uri);
40 branch.startPrefixMapping(prefix, uri);
41 }
42
43 public void endPrefixMapping(String prefix) throws SAXException {
44 super.endPrefixMapping(prefix);
45 branch.endPrefixMapping(prefix);
46 }
47
48 public void processingInstruction(String target, String data)
49 throws SAXException {
50 super.processingInstruction(target, data);
51 branch.processingInstruction(target, data);
52 }
53
54 public void setDocumentLocator(Locator locator) {
55 super.setDocumentLocator(locator);
56 branch.setDocumentLocator(locator);
57 }
58
59 public void startDocument() throws SAXException {
60 super.startDocument();
61 branch.startDocument();
62 }
63
64 public void endDocument() throws SAXException {
65 super.endDocument();
66 branch.endDocument();
67 }
68
69 public void startElement(String uri, String localName, String name,
70 Attributes atts) throws SAXException {
71 super.startElement(uri, localName, name, atts);
72 branch.startElement(uri, localName, name, atts);
73 }
74
75 public void endElement(String uri, String localName, String name)
76 throws SAXException {
77 super.endElement(uri, localName, name);
78 branch.endElement(uri, localName, name);
79 }
80
81 public void characters(char[] ch, int start, int length)
82 throws SAXException {
83 super.characters(ch, start, length);
84 branch.characters(ch, start, length);
85 }
86
87 public void ignorableWhitespace(char[] ch, int start, int length)
88 throws SAXException {
89 super.ignorableWhitespace(ch, start, length);
90 branch.ignorableWhitespace(ch, start, length);
91 }
92
93 public void skippedEntity(String name) throws SAXException {
94 super.skippedEntity(name);
95 branch.skippedEntity(name);
96 }
97
98 }