01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.xml;
18:
19: import org.xml.sax.ContentHandler;
20: import org.xml.sax.Locator;
21: import org.xml.sax.SAXException;
22: import org.xml.sax.Attributes;
23: import org.xml.sax.helpers.DefaultHandler;
24:
25: /**
26: * Wrap a ContentHandler in a DefaultHandler
27: *
28: * @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
29: */
30:
31: public final class DefaultHandlerWrapper extends DefaultHandler {
32: private final ContentHandler handler;
33:
34: public DefaultHandlerWrapper(ContentHandler handler) {
35: this .handler = handler;
36: }
37:
38: public void setDocumentLocator(Locator locator) {
39: handler.setDocumentLocator(locator);
40: }
41:
42: public void startDocument() throws SAXException {
43: handler.startDocument();
44: }
45:
46: public void endDocument() throws SAXException {
47: handler.endDocument();
48: }
49:
50: public void startPrefixMapping(String prefix, String uri)
51: throws SAXException {
52: handler.startPrefixMapping(prefix, uri);
53: }
54:
55: public void endPrefixMapping(String prefix) throws SAXException {
56: handler.endPrefixMapping(prefix);
57: }
58:
59: public void startElement(String namespaceURI, String localName,
60: String qName, Attributes atts) throws SAXException {
61: handler.startElement(namespaceURI, localName, qName, atts);
62: }
63:
64: public void endElement(String namespaceURI, String localName,
65: String qName) throws SAXException {
66: handler.endElement(namespaceURI, localName, qName);
67: }
68:
69: public void characters(char ch[], int start, int length)
70: throws SAXException {
71: handler.characters(ch, start, length);
72: }
73:
74: public void ignorableWhitespace(char ch[], int start, int length)
75: throws SAXException {
76: handler.ignorableWhitespace(ch, start, length);
77: }
78:
79: public void processingInstruction(String target, String data)
80: throws SAXException {
81: handler.processingInstruction(target, data);
82: }
83:
84: public void skippedEntity(String name) throws SAXException {
85: handler.skippedEntity(name);
86: }
87:
88: }
|