KickJava   Java API By Example, From Geeks To Geeks.

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


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.ContentHandler JavaDoc;
20 import org.xml.sax.SAXException JavaDoc;
21 import org.xml.sax.ext.LexicalHandler JavaDoc;
22
23 /**
24  * This class is an utility class proxying a SAX version 2.0
25  * {@link ContentHandler} and {@link LexicalHandler) and forwarding it those
26  * events received throug its {@link XMLConsumer}s interface.
27  *
28  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
29  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:20 $
30  */

31 public class XMLConsumerProxy
32     extends ContentHandlerProxy implements XMLConsumer
33 {
34     /** The {@link LexicalHandler} */
35     private LexicalHandler JavaDoc m_lexicalHandler;
36
37     /**
38      * Create a new <code>XMLConsumerProxy</code> instance.
39      */

40     public XMLConsumerProxy( final ContentHandler JavaDoc contentHandler, final LexicalHandler JavaDoc lexicalHandler )
41     {
42         super( contentHandler );
43         m_lexicalHandler = lexicalHandler;
44     }
45
46     /**
47      * Create a new <code>XMLConsumerProxy</code> instance.
48      */

49     public XMLConsumerProxy( final XMLConsumer xmlConsumer )
50     {
51         this( xmlConsumer, xmlConsumer );
52     }
53
54     /**
55      * Report the start of DTD declarations, if any.
56      *
57      * @param name The document type name.
58      * @param publicId The declared public identifier for the external DTD
59      * subset, or null if none was declared.
60      * @param systemId The declared system identifier for the external DTD
61      * subset, or null if none was declared.
62      */

63     public void startDTD( final String JavaDoc name,
64                           final String JavaDoc publicId,
65                           final String JavaDoc systemId )
66         throws SAXException JavaDoc
67     {
68         m_lexicalHandler.startDTD( name, publicId, systemId );
69     }
70
71     /**
72      * Report the end of DTD declarations.
73      */

74     public void endDTD()
75         throws SAXException JavaDoc
76     {
77         m_lexicalHandler.endDTD();
78     }
79
80     /**
81      * Report the beginning of an entity.
82      *
83      * @param name The name of the entity. If it is a parameter entity, the
84      * name will begin with '%'.
85      */

86     public void startEntity( final String JavaDoc name )
87         throws SAXException JavaDoc
88     {
89         m_lexicalHandler.startEntity( name );
90     }
91
92     /**
93      * Report the end of an entity.
94      *
95      * @param name The name of the entity that is ending.
96      */

97     public void endEntity( final String JavaDoc name )
98         throws SAXException JavaDoc
99     {
100         m_lexicalHandler.endEntity( name );
101     }
102
103     /**
104      * Report the start of a CDATA section.
105      */

106     public void startCDATA()
107         throws SAXException JavaDoc
108     {
109         m_lexicalHandler.startCDATA();
110     }
111
112     /**
113      * Report the end of a CDATA section.
114      */

115     public void endCDATA()
116         throws SAXException JavaDoc
117     {
118         m_lexicalHandler.endCDATA();
119     }
120
121     /**
122      * Report an XML comment anywhere in the document.
123      *
124      * @param ch An array holding the characters in the comment.
125      * @param start The starting position in the array.
126      * @param len The number of characters to use from the array.
127      */

128     public void comment( final char[] ch,
129                          final int start,
130                          final int len )
131         throws SAXException JavaDoc
132     {
133         m_lexicalHandler.comment( ch, start, len );
134     }
135 }
136
Popular Tags