KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > jaxp > TeeXMLDocumentFilterImpl


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

16
17 package org.apache.xerces.jaxp;
18
19 import org.apache.xerces.xni.Augmentations;
20 import org.apache.xerces.xni.NamespaceContext;
21 import org.apache.xerces.xni.QName;
22 import org.apache.xerces.xni.XMLAttributes;
23 import org.apache.xerces.xni.XMLDocumentHandler;
24 import org.apache.xerces.xni.XMLLocator;
25 import org.apache.xerces.xni.XMLResourceIdentifier;
26 import org.apache.xerces.xni.XMLString;
27 import org.apache.xerces.xni.XNIException;
28 import org.apache.xerces.xni.parser.XMLDocumentFilter;
29 import org.apache.xerces.xni.parser.XMLDocumentSource;
30
31 /**
32  * <p>XMLDocumentHandler which forks the pipeline to two other components.</p>
33  *
34  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
35  * @version $Id: TeeXMLDocumentFilterImpl.java,v 1.2 2005/06/21 15:53:38 mrglavas Exp $
36  */

37 class TeeXMLDocumentFilterImpl implements XMLDocumentFilter {
38     
39     /**
40      * The next component in the pipeline who receives the event.
41      * This component receives events after the "side" handler
42      * receives them.
43      */

44     private XMLDocumentHandler next;
45     
46     /**
47      * The component who intercepts events.
48      */

49     private XMLDocumentHandler side;
50     
51     /**
52      * The source of the event.
53      */

54     private XMLDocumentSource source;
55     
56     public XMLDocumentHandler getSide() {
57         return side;
58     }
59     
60     public void setSide(XMLDocumentHandler side) {
61         this.side = side;
62     }
63     
64     public XMLDocumentSource getDocumentSource() {
65         return source;
66     }
67     
68     public void setDocumentSource(XMLDocumentSource source) {
69         this.source = source;
70     }
71     
72     public XMLDocumentHandler getDocumentHandler() {
73         return next;
74     }
75     
76     public void setDocumentHandler(XMLDocumentHandler handler) {
77         next = handler;
78     }
79     
80     //
81
//
82
// XMLDocumentHandler implementation
83
//
84
//
85

86     public void characters(XMLString text, Augmentations augs) throws XNIException {
87         side.characters(text, augs);
88         next.characters(text, augs);
89     }
90     
91     public void comment(XMLString text, Augmentations augs) throws XNIException {
92         side.comment(text, augs);
93         next.comment(text, augs);
94     }
95     
96     public void doctypeDecl(String JavaDoc rootElement, String JavaDoc publicId, String JavaDoc systemId, Augmentations augs)
97         throws XNIException {
98         side.doctypeDecl(rootElement, publicId, systemId, augs);
99         next.doctypeDecl(rootElement, publicId, systemId, augs);
100     }
101     
102     public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException {
103         side.emptyElement(element, attributes, augs);
104         next.emptyElement(element, attributes, augs);
105     }
106     
107     public void endCDATA(Augmentations augs) throws XNIException {
108         side.endCDATA(augs);
109         next.endCDATA(augs);
110     }
111     
112     public void endDocument(Augmentations augs) throws XNIException {
113         side.endDocument(augs);
114         next.endDocument(augs);
115     }
116     
117     public void endElement(QName element, Augmentations augs) throws XNIException {
118         side.endElement(element, augs);
119         next.endElement(element, augs);
120     }
121     
122     public void endGeneralEntity(String JavaDoc name, Augmentations augs) throws XNIException {
123         side.endGeneralEntity(name, augs);
124         next.endGeneralEntity(name, augs);
125     }
126     
127     public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
128         side.ignorableWhitespace(text, augs);
129         next.ignorableWhitespace(text, augs);
130     }
131     
132     public void processingInstruction(String JavaDoc target, XMLString data, Augmentations augs) throws XNIException {
133         side.processingInstruction(target, data, augs);
134         next.processingInstruction(target, data, augs);
135     }
136     
137     public void startCDATA(Augmentations augs) throws XNIException {
138         side.startCDATA(augs);
139         next.startCDATA(augs);
140     }
141     
142     public void startDocument(
143             XMLLocator locator,
144             String JavaDoc encoding,
145             NamespaceContext namespaceContext,
146             Augmentations augs)
147         throws XNIException {
148         side.startDocument(locator, encoding, namespaceContext, augs);
149         next.startDocument(locator, encoding, namespaceContext, augs);
150     }
151     
152     public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException {
153         side.startElement(element, attributes, augs);
154         next.startElement(element, attributes, augs);
155     }
156     
157     public void startGeneralEntity(String JavaDoc name, XMLResourceIdentifier identifier, String JavaDoc encoding, Augmentations augs)
158         throws XNIException {
159         side.startGeneralEntity(name, identifier, encoding, augs);
160         next.startGeneralEntity(name, identifier, encoding, augs);
161     }
162     
163     public void textDecl(String JavaDoc version, String JavaDoc encoding, Augmentations augs) throws XNIException {
164         side.textDecl(version, encoding, augs);
165         next.textDecl(version, encoding, augs);
166     }
167     
168     public void xmlDecl(String JavaDoc version, String JavaDoc encoding, String JavaDoc standalone, Augmentations augs) throws XNIException {
169         side.xmlDecl(version, encoding, standalone, augs);
170         next.xmlDecl(version, encoding, standalone, augs);
171     }
172     
173 }
174
Popular Tags