KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > xml > sax > ContentHandlerProxy


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.xml.sax;
18
19 import org.xml.sax.Attributes JavaDoc;
20 import org.xml.sax.ContentHandler JavaDoc;
21 import org.xml.sax.Locator JavaDoc;
22 import org.xml.sax.SAXException JavaDoc;
23
24 /**
25  * This class is an utility class proxying a SAX version 2.0
26  * {@link ContentHandler} and forwarding the events to it.
27  * <br>
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:20 $
31  */

32 public class ContentHandlerProxy
33     implements ContentHandler JavaDoc
34 {
35     /** The current {@link ContentHandler}. */
36     private final ContentHandler JavaDoc m_contentHandler;
37
38     /**
39      * Create a new <code>ContentHandlerWrapper</code> instance.
40      */

41     public ContentHandlerProxy( final ContentHandler JavaDoc contentHandler )
42     {
43         m_contentHandler = contentHandler;
44     }
45
46     /**
47      * Receive an object for locating the origin of SAX document events.
48      */

49     public void setDocumentLocator( final Locator JavaDoc locator )
50     {
51         m_contentHandler.setDocumentLocator( locator );
52     }
53
54     /**
55      * Receive notification of the beginning of a document.
56      */

57     public void startDocument()
58         throws SAXException JavaDoc
59     {
60         m_contentHandler.startDocument();
61     }
62
63     /**
64      * Receive notification of the end of a document.
65      */

66     public void endDocument()
67         throws SAXException JavaDoc
68     {
69         m_contentHandler.endDocument();
70     }
71
72     /**
73      * Begin the scope of a prefix-URI Namespace mapping.
74      */

75     public void startPrefixMapping( final String JavaDoc prefix,
76                                     final String JavaDoc uri )
77         throws SAXException JavaDoc
78     {
79         m_contentHandler.startPrefixMapping( prefix, uri );
80     }
81
82     /**
83      * End the scope of a prefix-URI mapping.
84      */

85     public void endPrefixMapping( final String JavaDoc prefix )
86         throws SAXException JavaDoc
87     {
88         m_contentHandler.endPrefixMapping( prefix );
89     }
90
91     /**
92      * Receive notification of the beginning of an element.
93      */

94     public void startElement( final String JavaDoc uri,
95                               final String JavaDoc loc,
96                               final String JavaDoc raw,
97                               final Attributes JavaDoc a )
98         throws SAXException JavaDoc
99     {
100         m_contentHandler.startElement( uri, loc, raw, a );
101     }
102
103     /**
104      * Receive notification of the end of an element.
105      */

106     public void endElement( final String JavaDoc uri,
107                             final String JavaDoc loc,
108                             final String JavaDoc raw )
109         throws SAXException JavaDoc
110     {
111         m_contentHandler.endElement( uri, loc, raw );
112     }
113
114     /**
115      * Receive notification of character data.
116      */

117     public void characters( final char[] ch,
118                             final int start,
119                             final int len )
120         throws SAXException JavaDoc
121     {
122         m_contentHandler.characters( ch, start, len );
123     }
124
125     /**
126      * Receive notification of ignorable whitespace in element content.
127      */

128     public void ignorableWhitespace( final char[] ch,
129                                      final int start,
130                                      final int len )
131         throws SAXException JavaDoc
132     {
133         m_contentHandler.ignorableWhitespace( ch, start, len );
134     }
135
136     /**
137      * Receive notification of a processing instruction.
138      */

139     public void processingInstruction( final String JavaDoc target,
140                                        final String JavaDoc data )
141         throws SAXException JavaDoc
142     {
143         m_contentHandler.processingInstruction( target, data );
144     }
145
146     /**
147      * Receive notification of a skipped entity.
148      *
149      * @param name The name of the skipped entity. If it is a parameter
150      * entity, the name will begin with '%'.
151      */

152     public void skippedEntity( final String JavaDoc name )
153         throws SAXException JavaDoc
154     {
155         m_contentHandler.skippedEntity( name );
156     }
157 }
158
Popular Tags