annotate NGSrich_0.5.5/src/org/jdom/transform/JDOMResult.java @ 0:89ad0a9cca52 default tip

Uploaded
author pfrommolt
date Mon, 21 Nov 2011 08:12:19 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
1 /*--
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
2
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
3 $Id: JDOMResult.java,v 1.24 2007/11/10 05:29:02 jhunter Exp $
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
4
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
5 Copyright (C) 2001-2007 Jason Hunter & Brett McLaughlin.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
6 All rights reserved.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
7
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
8 Redistribution and use in source and binary forms, with or without
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
9 modification, are permitted provided that the following conditions
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
10 are met:
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
11
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
12 1. Redistributions of source code must retain the above copyright
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
13 notice, this list of conditions, and the following disclaimer.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
14
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
15 2. Redistributions in binary form must reproduce the above copyright
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
16 notice, this list of conditions, and the disclaimer that follows
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
17 these conditions in the documentation and/or other materials
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
18 provided with the distribution.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
19
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
20 3. The name "JDOM" must not be used to endorse or promote products
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
21 derived from this software without prior written permission. For
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
22 written permission, please contact <request_AT_jdom_DOT_org>.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
23
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
24 4. Products derived from this software may not be called "JDOM", nor
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
25 may "JDOM" appear in their name, without prior written permission
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
26 from the JDOM Project Management <request_AT_jdom_DOT_org>.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
27
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
28 In addition, we request (but do not require) that you include in the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
29 end-user documentation provided with the redistribution and/or in the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
30 software itself an acknowledgement equivalent to the following:
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
31 "This product includes software developed by the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
32 JDOM Project (http://www.jdom.org/)."
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
33 Alternatively, the acknowledgment may be graphical using the logos
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
34 available at http://www.jdom.org/images/logos.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
35
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
36 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
37 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
38 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
39 DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
40 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
41 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
42 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
43 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
44 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
45 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
46 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
47 SUCH DAMAGE.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
48
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
49 This software consists of voluntary contributions made by many
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
50 individuals on behalf of the JDOM Project and was originally
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
51 created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
52 Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
53 on the JDOM Project, please see <http://www.jdom.org/>.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
54
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
55 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
56
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
57 package org.jdom.transform;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
58
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
59 import java.util.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
60
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
61 import javax.xml.transform.sax.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
62
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
63 import org.jdom.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
64 import org.jdom.input.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
65 import org.xml.sax.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
66 import org.xml.sax.ext.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
67 import org.xml.sax.helpers.*;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
68
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
69 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
70 * A holder for an XSL Transformation result, generally a list of nodes
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
71 * although it can be a JDOM Document also. As stated by the XSLT 1.0
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
72 * specification, the result tree generated by an XSL transformation is not
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
73 * required to be a well-formed XML document. The result tree may have "any
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
74 * sequence of nodes as children that would be possible for an
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
75 * element node".
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
76 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
77 * The following example shows how to apply an XSL Transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
78 * to a JDOM document and get the transformation result in the form
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
79 * of a list of JDOM nodes:
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
80 * <pre><code>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
81 * public static List transform(Document doc, String stylesheet)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
82 * throws JDOMException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
83 * try {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
84 * Transformer transformer = TransformerFactory.newInstance()
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
85 * .newTransformer(new StreamSource(stylesheet));
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
86 * JDOMSource in = new JDOMSource(doc);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
87 * JDOMResult out = new JDOMResult();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
88 * transformer.transform(in, out);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
89 * return out.getResult();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
90 * }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
91 * catch (TransformerException e) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
92 * throw new JDOMException("XSLT Transformation failed", e);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
93 * }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
94 * }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
95 * </code></pre>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
96 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
97 * @see org.jdom.transform.JDOMSource
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
98 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
99 * @version $Revision: 1.24 $, $Date: 2007/11/10 05:29:02 $
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
100 * @author Laurent Bihanic
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
101 * @author Jason Hunter
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
102 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
103 public class JDOMResult extends SAXResult {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
104
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
105 private static final String CVS_ID =
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
106 "@(#) $RCSfile: JDOMResult.java,v $ $Revision: 1.24 $ $Date: 2007/11/10 05:29:02 $ $Name: jdom_1_1_1 $";
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
107
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
108 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
109 * If {@link javax.xml.transform.TransformerFactory#getFeature}
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
110 * returns <code>true</code> when passed this value as an
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
111 * argument, the Transformer natively supports JDOM.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
112 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
113 * <strong>Note</strong>: This implementation does not override
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
114 * the {@link SAXResult#FEATURE} value defined by its superclass
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
115 * to be considered as a SAXResult by Transformer implementations
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
116 * not natively supporting JDOM.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
117 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
118 public final static String JDOM_FEATURE =
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
119 "http://org.jdom.transform.JDOMResult/feature";
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
120
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
121 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
122 * The result of a transformation, as set by Transformer
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
123 * implementations that natively support JDOM, as a JDOM document
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
124 * or a list of JDOM nodes.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
125 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
126 private Object result = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
127
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
128 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
129 * Whether the application queried the result (as a list or a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
130 * document) since it was last set.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
131 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
132 private boolean queried = false;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
133
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
134 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
135 * The custom JDOM factory to use when building the transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
136 * result or <code>null</code> to use the default JDOM classes.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
137 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
138 private JDOMFactory factory = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
139
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
140 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
141 * Public default constructor.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
142 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
143 public JDOMResult() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
144 // Allocate custom builder object...
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
145 DocumentBuilder builder = new DocumentBuilder();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
146
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
147 // And use it as ContentHandler and LexicalHandler.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
148 super.setHandler(builder);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
149 super.setLexicalHandler(builder);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
150 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
151
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
152 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
153 * Sets the object(s) produced as result of an XSL Transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
154 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
155 * <strong>Note</strong>: This method shall be used by the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
156 * {@link javax.xml.transform.Transformer} implementations that
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
157 * natively support JDOM to directly set the transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
158 * result rather than considering this object as a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
159 * {@link SAXResult}. Applications should <i>not</i> use this
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
160 * method.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
161 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
162 * @param result the result of a transformation as a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
163 * {@link java.util.List list} of JDOM nodes
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
164 * (Elements, Texts, Comments, PIs...).
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
165 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
166 * @see #getResult
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
167 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
168 public void setResult(List result) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
169 this.result = result;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
170 this.queried = false;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
171 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
172
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
173 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
174 * Returns the result of an XSL Transformation as a list of JDOM
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
175 * nodes.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
176 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
177 * If the result of the transformation is a JDOM document,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
178 * this method converts it into a list of JDOM nodes; any
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
179 * subsequent call to {@link #getDocument} will return
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
180 * <code>null</code>.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
181 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
182 * @return the transformation result as a (possibly empty) list of
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
183 * JDOM nodes (Elements, Texts, Comments, PIs...).
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
184 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
185 public List getResult() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
186 List nodes = Collections.EMPTY_LIST;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
187
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
188 // Retrieve result from the document builder if not set.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
189 this.retrieveResult();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
190
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
191 if (result instanceof List) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
192 nodes = (List)result;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
193 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
194 else {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
195 if ((result instanceof Document) && (queried == false)) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
196 List content = ((Document)result).getContent();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
197 nodes = new ArrayList(content.size());
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
198
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
199 while (content.size() != 0)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
200 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
201 Object o = content.remove(0);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
202 nodes.add(o);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
203 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
204 result = nodes;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
205 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
206 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
207 queried = true;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
208
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
209 return (nodes);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
210 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
211
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
212 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
213 * Sets the document produced as result of an XSL Transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
214 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
215 * <strong>Note</strong>: This method shall be used by the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
216 * {@link javax.xml.transform.Transformer} implementations that
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
217 * natively support JDOM to directly set the transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
218 * result rather than considering this object as a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
219 * {@link SAXResult}. Applications should <i>not</i> use this
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
220 * method.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
221 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
222 * @param document the JDOM document result of a transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
223 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
224 * @see #setResult
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
225 * @see #getDocument
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
226 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
227 public void setDocument(Document document) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
228 this.result = document;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
229 this.queried = false;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
230 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
231
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
232 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
233 * Returns the result of an XSL Transformation as a JDOM document.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
234 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
235 * If the result of the transformation is a list of nodes,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
236 * this method attempts to convert it into a JDOM document. If
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
237 * successful, any subsequent call to {@link #getResult} will
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
238 * return an empty list.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
239 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
240 * <strong>Warning</strong>: The XSLT 1.0 specification states that
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
241 * the output of an XSL transformation is not a well-formed XML
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
242 * document but a list of nodes. Applications should thus use
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
243 * {@link #getResult} instead of this method or at least expect
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
244 * <code>null</code> documents to be returned.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
245 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
246 * @return the transformation result as a JDOM document or
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
247 * <code>null</code> if the result of the transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
248 * can not be converted into a well-formed document.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
249 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
250 * @see #getResult
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
251 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
252 public Document getDocument() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
253 Document doc = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
254
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
255 // Retrieve result from the document builder if not set.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
256 this.retrieveResult();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
257
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
258 if (result instanceof Document) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
259 doc = (Document)result;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
260 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
261 else {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
262 if ((result instanceof List) && (queried == false)) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
263 // Try to create a document from the result nodes
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
264 try {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
265 JDOMFactory f = this.getFactory();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
266 if (f == null) { f = new DefaultJDOMFactory(); }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
267
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
268 doc = f.document(null);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
269 doc.setContent((List)result);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
270
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
271 result = doc;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
272 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
273 catch (RuntimeException ex1) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
274 // Some of the result nodes are not valid children of a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
275 // Document node. => return null.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
276 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
277 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
278 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
279 queried = true;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
280
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
281 return (doc);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
282 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
283
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
284 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
285 * Sets a custom JDOMFactory to use when building the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
286 * transformation result. Use a custom factory to build the tree
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
287 * with your own subclasses of the JDOM classes.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
288 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
289 * @param factory the custom <code>JDOMFactory</code> to use or
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
290 * <code>null</code> to use the default JDOM
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
291 * classes.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
292 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
293 * @see #getFactory
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
294 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
295 public void setFactory(JDOMFactory factory) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
296 this.factory = factory;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
297 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
298
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
299 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
300 * Returns the custom JDOMFactory used to build the transformation
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
301 * result.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
302 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
303 * @return the custom <code>JDOMFactory</code> used to build the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
304 * transformation result or <code>null</code> if the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
305 * default JDOM classes are being used.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
306 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
307 * @see #setFactory
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
308 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
309 public JDOMFactory getFactory() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
310 return this.factory;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
311 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
312
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
313 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
314 * Checks whether a transformation result has been set and, if not,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
315 * retrieves the result tree being built by the document builder.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
316 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
317 private void retrieveResult() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
318 if (result == null) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
319 this.setResult(((DocumentBuilder)this.getHandler()).getResult());
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
320 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
321 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
322
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
323 //-------------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
324 // SAXResult overwritten methods
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
325 //-------------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
326
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
327 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
328 * Sets the target to be a SAX2 ContentHandler.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
329 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
330 * @param handler Must be a non-null ContentHandler reference.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
331 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
332 public void setHandler(ContentHandler handler) { }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
333
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
334 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
335 * Sets the SAX2 LexicalHandler for the output.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
336 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
337 * This is needed to handle XML comments and the like. If the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
338 * lexical handler is not set, an attempt should be made by the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
339 * transformer to cast the ContentHandler to a LexicalHandler.</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
340 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
341 * @param handler A non-null LexicalHandler for
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
342 * handling lexical parse events.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
343 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
344 public void setLexicalHandler(LexicalHandler handler) { }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
345
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
346
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
347 //=========================================================================
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
348 // FragmentHandler nested class
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
349 //=========================================================================
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
350
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
351 private static class FragmentHandler extends SAXHandler {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
352 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
353 * A dummy root element required by SAXHandler that can only
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
354 * cope with well-formed documents.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
355 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
356 private Element dummyRoot = new Element("root", null, null);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
357
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
358 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
359 * Public constructor.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
360 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
361 public FragmentHandler(JDOMFactory factory) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
362 super(factory);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
363
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
364 // Add a dummy root element to the being-built document as XSL
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
365 // transformation can output node lists instead of well-formed
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
366 // documents.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
367 this.pushElement(dummyRoot);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
368 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
369
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
370 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
371 * Returns the result of an XSL Transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
372 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
373 * @return the transformation result as a (possibly empty) list of
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
374 * JDOM nodes (Elements, Texts, Comments, PIs...).
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
375 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
376 public List getResult() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
377 // Flush remaining text content in case the last text segment is
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
378 // outside an element.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
379 try {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
380 this.flushCharacters();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
381 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
382 catch (SAXException e) { /* Ignore... */ }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
383 return this.getDetachedContent(dummyRoot);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
384 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
385
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
386 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
387 * Returns the content of a JDOM Element detached from it.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
388 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
389 * @param elt the element to get the content from.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
390 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
391 * @return a (possibly empty) list of JDOM nodes, detached from
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
392 * their parent.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
393 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
394 private List getDetachedContent(Element elt) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
395 List content = elt.getContent();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
396 List nodes = new ArrayList(content.size());
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
397
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
398 while (content.size() != 0)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
399 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
400 Object o = content.remove(0);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
401 nodes.add(o);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
402 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
403 return (nodes);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
404 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
405 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
406
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
407 //=========================================================================
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
408 // DocumentBuilder inner class
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
409 //=========================================================================
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
410
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
411 private class DocumentBuilder extends XMLFilterImpl
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
412 implements LexicalHandler {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
413 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
414 * The actual JDOM document builder.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
415 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
416 private FragmentHandler saxHandler = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
417
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
418 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
419 * Whether the startDocument event was received. Some XSLT
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
420 * processors such as Oracle's do not fire this event.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
421 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
422 private boolean startDocumentReceived = false;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
423
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
424 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
425 * Public default constructor.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
426 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
427 public DocumentBuilder() { }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
428
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
429 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
430 * Returns the result of an XSL Transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
431 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
432 * @return the transformation result as a (possibly empty) list of
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
433 * JDOM nodes (Elements, Texts, Comments, PIs...) or
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
434 * <code>null</code> if no new transformation occurred
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
435 * since the result of the previous one was returned.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
436 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
437 public List getResult() {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
438 List result = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
439
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
440 if (this.saxHandler != null) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
441 // Retrieve result from SAX content handler.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
442 result = this.saxHandler.getResult();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
443
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
444 // Detach the (non-reusable) SAXHandler instance.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
445 this.saxHandler = null;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
446
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
447 // And get ready for the next transformation.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
448 this.startDocumentReceived = false;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
449 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
450 return result;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
451 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
452
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
453 private void ensureInitialization() throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
454 // Trigger document initialization if XSLT processor failed to
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
455 // fire the startDocument event.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
456 if (this.startDocumentReceived == false) {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
457 this.startDocument();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
458 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
459 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
460
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
461 //-----------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
462 // XMLFilterImpl overwritten methods
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
463 //-----------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
464
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
465 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
466 * <i>[SAX ContentHandler interface support]</i> Processes a
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
467 * start of document event.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
468 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
469 * This implementation creates a new JDOM document builder and
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
470 * marks the current result as "under construction".</p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
471 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
472 * @throws SAXException if any error occurred while creating
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
473 * the document builder.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
474 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
475 public void startDocument() throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
476 this.startDocumentReceived = true;
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
477
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
478 // Reset any previously set result.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
479 setResult(null);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
480
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
481 // Create the actual JDOM document builder and register it as
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
482 // ContentHandler on the superclass (XMLFilterImpl): this
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
483 // implementation will take care of propagating the LexicalHandler
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
484 // events.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
485 this.saxHandler = new FragmentHandler(getFactory());
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
486 super.setContentHandler(this.saxHandler);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
487
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
488 // And propagate event.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
489 super.startDocument();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
490 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
491
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
492 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
493 * <i>[SAX ContentHandler interface support]</i> Receives
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
494 * notification of the beginning of an element.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
495 * <p>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
496 * This implementation ensures that startDocument() has been
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
497 * called prior processing an element.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
498 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
499 * @param nsURI the Namespace URI, or the empty string if
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
500 * the element has no Namespace URI or if
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
501 * Namespace processing is not being performed.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
502 * @param localName the local name (without prefix), or the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
503 * empty string if Namespace processing is
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
504 * not being performed.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
505 * @param qName the qualified name (with prefix), or the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
506 * empty string if qualified names are not
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
507 * available.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
508 * @param atts The attributes attached to the element. If
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
509 * there are no attributes, it shall be an
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
510 * empty Attributes object.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
511 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
512 * @throws SAXException if any error occurred while creating
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
513 * the document builder.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
514 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
515 public void startElement(String nsURI, String localName, String qName,
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
516 Attributes atts) throws SAXException
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
517 {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
518 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
519 super.startElement(nsURI, localName, qName, atts);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
520 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
521
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
522 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
523 * <i>[SAX ContentHandler interface support]</i> Begins the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
524 * scope of a prefix-URI Namespace mapping.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
525 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
526 public void startPrefixMapping(String prefix, String uri)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
527 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
528 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
529 super.startPrefixMapping(prefix, uri);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
530 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
531
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
532 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
533 * <i>[SAX ContentHandler interface support]</i> Receives
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
534 * notification of character data.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
535 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
536 public void characters(char ch[], int start, int length)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
537 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
538 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
539 super.characters(ch, start, length);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
540 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
541
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
542 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
543 * <i>[SAX ContentHandler interface support]</i> Receives
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
544 * notification of ignorable whitespace in element content.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
545 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
546 public void ignorableWhitespace(char ch[], int start, int length)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
547 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
548 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
549 super.ignorableWhitespace(ch, start, length);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
550 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
551
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
552 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
553 * <i>[SAX ContentHandler interface support]</i> Receives
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
554 * notification of a processing instruction.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
555 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
556 public void processingInstruction(String target, String data)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
557 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
558 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
559 super.processingInstruction(target, data);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
560 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
561
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
562 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
563 * <i>[SAX ContentHandler interface support]</i> Receives
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
564 * notification of a skipped entity.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
565 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
566 public void skippedEntity(String name) throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
567 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
568 super.skippedEntity(name);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
569 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
570
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
571 //-----------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
572 // LexicalHandler interface support
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
573 //-----------------------------------------------------------------------
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
574
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
575 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
576 * <i>[SAX LexicalHandler interface support]</i> Reports the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
577 * start of DTD declarations, if any.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
578 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
579 * @param name the document type name.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
580 * @param publicId the declared public identifier for the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
581 * external DTD subset, or <code>null</code>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
582 * if none was declared.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
583 * @param systemId the declared system identifier for the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
584 * external DTD subset, or <code>null</code>
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
585 * if none was declared.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
586 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
587 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
588 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
589 public void startDTD(String name, String publicId, String systemId)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
590 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
591 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
592 this.saxHandler.startDTD(name, publicId, systemId);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
593 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
594
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
595 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
596 * <i>[SAX LexicalHandler interface support]</i> Reports the end
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
597 * of DTD declarations.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
598 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
599 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
600 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
601 public void endDTD() throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
602 this.saxHandler.endDTD();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
603 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
604
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
605 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
606 * <i>[SAX LexicalHandler interface support]</i> Reports the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
607 * beginning of some internal and external XML entities.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
608 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
609 * @param name the name of the entity. If it is a parameter
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
610 * entity, the name will begin with '%', and if it
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
611 * is the external DTD subset, it will be "[dtd]".
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
612 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
613 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
614 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
615 public void startEntity(String name) throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
616 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
617 this.saxHandler.startEntity(name);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
618 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
619
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
620 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
621 * <i>[SAX LexicalHandler interface support]</i> Reports the end
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
622 * of an entity.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
623 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
624 * @param name the name of the entity that is ending.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
625 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
626 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
627 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
628 public void endEntity(String name) throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
629 this.saxHandler.endEntity(name);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
630 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
631
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
632 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
633 * <i>[SAX LexicalHandler interface support]</i> Reports the
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
634 * start of a CDATA section.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
635 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
636 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
637 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
638 public void startCDATA() throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
639 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
640 this.saxHandler.startCDATA();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
641 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
642
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
643 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
644 * <i>[SAX LexicalHandler interface support]</i> Reports the end
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
645 * of a CDATA section.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
646 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
647 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
648 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
649 public void endCDATA() throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
650 this.saxHandler.endCDATA();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
651 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
652
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
653 /**
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
654 * <i>[SAX LexicalHandler interface support]</i> Reports an XML
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
655 * comment anywhere in the document.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
656 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
657 * @param ch an array holding the characters in the comment.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
658 * @param start the starting position in the array.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
659 * @param length the number of characters to use from the array.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
660 *
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
661 * @throws SAXException The application may raise an exception.
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
662 */
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
663 public void comment(char ch[], int start, int length)
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
664 throws SAXException {
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
665 this.ensureInitialization();
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
666 this.saxHandler.comment(ch, start, length);
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
667 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
668 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
669 }
89ad0a9cca52 Uploaded
pfrommolt
parents:
diff changeset
670