001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.xml;
018:
019: import org.xml.sax.Attributes;
020: import org.xml.sax.Locator;
021: import org.xml.sax.SAXException;
022:
023: /**
024: * This class provides a bridge class to connect to existing content
025: * handlers and lexical handlers.
026: *
027: * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
028: * @version CVS $Id: AbstractXMLPipe.java 433543 2006-08-22 06:22:54Z crossley $
029: */
030: public abstract class AbstractXMLPipe extends AbstractXMLProducer
031: implements XMLPipe {
032:
033: /**
034: * Receive an object for locating the origin of SAX document events.
035: *
036: * @param locator An object that can return the location of any SAX
037: * document event.
038: */
039: public void setDocumentLocator(Locator locator) {
040: contentHandler.setDocumentLocator(locator);
041: }
042:
043: /**
044: * Receive notification of the beginning of a document.
045: */
046: public void startDocument() throws SAXException {
047: contentHandler.startDocument();
048: }
049:
050: /**
051: * Receive notification of the end of a document.
052: */
053: public void endDocument() throws SAXException {
054: contentHandler.endDocument();
055: }
056:
057: /**
058: * Begin the scope of a prefix-URI Namespace mapping.
059: *
060: * @param prefix The Namespace prefix being declared.
061: * @param uri The Namespace URI the prefix is mapped to.
062: */
063: public void startPrefixMapping(String prefix, String uri)
064: throws SAXException {
065: contentHandler.startPrefixMapping(prefix, uri);
066: }
067:
068: /**
069: * End the scope of a prefix-URI mapping.
070: *
071: * @param prefix The prefix that was being mapping.
072: */
073: public void endPrefixMapping(String prefix) throws SAXException {
074: contentHandler.endPrefixMapping(prefix);
075: }
076:
077: /**
078: * Receive notification of the beginning of an element.
079: *
080: * @param uri The Namespace URI, or the empty string if the element has no
081: * Namespace URI or if Namespace
082: * processing is not being performed.
083: * @param loc The local name (without prefix), or the empty string if
084: * Namespace processing is not being performed.
085: * @param raw The raw XML 1.0 name (with prefix), or the empty string if
086: * raw names are not available.
087: * @param a The attributes attached to the element. If there are no
088: * attributes, it shall be an empty Attributes object.
089: */
090: public void startElement(String uri, String loc, String raw,
091: Attributes a) throws SAXException {
092: contentHandler.startElement(uri, loc, raw, a);
093: }
094:
095: /**
096: * Receive notification of the end of an element.
097: *
098: * @param uri The Namespace URI, or the empty string if the element has no
099: * Namespace URI or if Namespace
100: * processing is not being performed.
101: * @param loc The local name (without prefix), or the empty string if
102: * Namespace processing is not being performed.
103: * @param raw The raw XML 1.0 name (with prefix), or the empty string if
104: * raw names are not available.
105: */
106: public void endElement(String uri, String loc, String raw)
107: throws SAXException {
108: contentHandler.endElement(uri, loc, raw);
109: }
110:
111: /**
112: * Receive notification of character data.
113: *
114: * @param c The characters from the XML document.
115: * @param start The start position in the array.
116: * @param len The number of characters to read from the array.
117: */
118: public void characters(char c[], int start, int len)
119: throws SAXException {
120: contentHandler.characters(c, start, len);
121: }
122:
123: /**
124: * Receive notification of ignorable whitespace in element content.
125: *
126: * @param c The characters from the XML document.
127: * @param start The start position in the array.
128: * @param len The number of characters to read from the array.
129: */
130: public void ignorableWhitespace(char c[], int start, int len)
131: throws SAXException {
132: contentHandler.ignorableWhitespace(c, start, len);
133: }
134:
135: /**
136: * Receive notification of a processing instruction.
137: *
138: * @param target The processing instruction target.
139: * @param data The processing instruction data, or null if none was
140: * supplied.
141: */
142: public void processingInstruction(String target, String data)
143: throws SAXException {
144: contentHandler.processingInstruction(target, data);
145: }
146:
147: /**
148: * Receive notification of a skipped entity.
149: *
150: * @param name The name of the skipped entity. If it is a parameter
151: * entity, the name will begin with '%'.
152: */
153: public void skippedEntity(String name) throws SAXException {
154: contentHandler.skippedEntity(name);
155: }
156:
157: /**
158: * Report the start of DTD declarations, if any.
159: *
160: * @param name The document type name.
161: * @param publicId The declared public identifier for the external DTD
162: * subset, or null if none was declared.
163: * @param systemId The declared system identifier for the external DTD
164: * subset, or null if none was declared.
165: */
166: public void startDTD(String name, String publicId, String systemId)
167: throws SAXException {
168: lexicalHandler.startDTD(name, publicId, systemId);
169: }
170:
171: /**
172: * Report the end of DTD declarations.
173: */
174: public void endDTD() throws SAXException {
175: lexicalHandler.endDTD();
176: }
177:
178: /**
179: * Report the beginning of an entity.
180: *
181: * @param name The name of the entity. If it is a parameter entity, the
182: * name will begin with '%'.
183: */
184: public void startEntity(String name) throws SAXException {
185: lexicalHandler.startEntity(name);
186: }
187:
188: /**
189: * Report the end of an entity.
190: *
191: * @param name The name of the entity that is ending.
192: */
193: public void endEntity(String name) throws SAXException {
194: lexicalHandler.endEntity(name);
195: }
196:
197: /**
198: * Report the start of a CDATA section.
199: */
200: public void startCDATA() throws SAXException {
201: lexicalHandler.startCDATA();
202: }
203:
204: /**
205: * Report the end of a CDATA section.
206: */
207: public void endCDATA() throws SAXException {
208: lexicalHandler.endCDATA();
209: }
210:
211: /**
212: * Report an XML comment anywhere in the document.
213: *
214: * @param ch An array holding the characters in the comment.
215: * @param start The starting position in the array.
216: * @param len The number of characters to use from the array.
217: */
218: public void comment(char ch[], int start, int len)
219: throws SAXException {
220: lexicalHandler.comment(ch, start, len);
221: }
222: }
|