KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > transformer > TransformerIdentityImpl


1 /*
2  * Copyright 1999-2004 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  * $Id: TransformerIdentityImpl.java,v 1.31 2004/02/23 21:33:14 igorh Exp $
18  */

19 package org.apache.xalan.transformer;
20
21 import java.io.IOException JavaDoc;
22 import java.util.Hashtable JavaDoc;
23 import java.util.Properties JavaDoc;
24
25 import javax.xml.parsers.DocumentBuilder JavaDoc;
26 import javax.xml.parsers.DocumentBuilderFactory JavaDoc;
27 import javax.xml.parsers.ParserConfigurationException JavaDoc;
28 import javax.xml.transform.ErrorListener JavaDoc;
29 import javax.xml.transform.OutputKeys JavaDoc;
30 import javax.xml.transform.Result JavaDoc;
31 import javax.xml.transform.Source JavaDoc;
32 import javax.xml.transform.Transformer JavaDoc;
33 import javax.xml.transform.TransformerException JavaDoc;
34 import javax.xml.transform.URIResolver JavaDoc;
35 import javax.xml.transform.dom.DOMResult JavaDoc;
36 import javax.xml.transform.dom.DOMSource JavaDoc;
37 import javax.xml.transform.sax.SAXResult JavaDoc;
38 import javax.xml.transform.sax.SAXSource JavaDoc;
39 import javax.xml.transform.sax.TransformerHandler JavaDoc;
40 import javax.xml.transform.stream.StreamSource JavaDoc;
41 import javax.xml.transform.stream.StreamResult JavaDoc;
42
43 import org.apache.xalan.res.XSLMessages;
44 import org.apache.xalan.res.XSLTErrorResources;
45 import org.apache.xalan.templates.OutputProperties;
46 import org.apache.xml.serializer.Serializer;
47 import org.apache.xml.serializer.SerializerFactory;
48 import org.apache.xml.serializer.Method;
49 import org.apache.xml.utils.DOMBuilder;
50 import org.apache.xml.utils.TreeWalker;
51 import org.apache.xml.utils.XMLReaderManager;
52
53 import org.w3c.dom.Document JavaDoc;
54 import org.w3c.dom.DocumentFragment JavaDoc;
55 import org.w3c.dom.Node JavaDoc;
56
57 import org.xml.sax.Attributes JavaDoc;
58 import org.xml.sax.ContentHandler JavaDoc;
59 import org.xml.sax.DTDHandler JavaDoc;
60 import org.xml.sax.InputSource JavaDoc;
61 import org.xml.sax.Locator JavaDoc;
62 import org.xml.sax.SAXException JavaDoc;
63 import org.xml.sax.XMLReader JavaDoc;
64 import org.xml.sax.ext.DeclHandler JavaDoc;
65 import org.xml.sax.ext.LexicalHandler JavaDoc;
66
67 /**
68  * This class implements an identity transformer for
69  * {@link javax.xml.transform.sax.SAXTransformerFactory#newTransformerHandler()}
70  * and {@link javax.xml.transform.TransformerFactory#newTransformer()}. It
71  * simply feeds SAX events directly to a serializer ContentHandler, if the
72  * result is a stream. If the result is a DOM, it will send the events to
73  * {@link org.apache.xml.utils.DOMBuilder}. If the result is another
74  * content handler, it will simply pass the events on.
75  */

76 public class TransformerIdentityImpl extends Transformer JavaDoc
77         implements TransformerHandler JavaDoc, DeclHandler JavaDoc
78 {
79
80   /**
81    * Constructor TransformerIdentityImpl creates an identity transform.
82    *
83    */

84   public TransformerIdentityImpl()
85   {
86     m_outputFormat = new OutputProperties(Method.XML);
87   }
88
89   /**
90    * Enables the user of the TransformerHandler to set the
91    * to set the Result for the transformation.
92    *
93    * @param result A Result instance, should not be null.
94    *
95    * @throws IllegalArgumentException if result is invalid for some reason.
96    */

97   public void setResult(Result JavaDoc result) throws IllegalArgumentException JavaDoc
98   {
99     if(null == result)
100       throw new IllegalArgumentException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"Result should not be null");
101
m_result = result;
102   }
103
104   /**
105    * Set the base ID (URI or system ID) from where relative
106    * URLs will be resolved.
107    * @param systemID Base URI for the source tree.
108    */

109   public void setSystemId(String JavaDoc systemID)
110   {
111     m_systemID = systemID;
112   }
113
114   /**
115    * Get the base ID (URI or system ID) from where relative
116    * URLs will be resolved.
117    * @return The systemID that was set with {@link #setSystemId}.
118    */

119   public String JavaDoc getSystemId()
120   {
121     return m_systemID;
122   }
123
124   /**
125    * Get the Transformer associated with this handler, which
126    * is needed in order to set parameters and output properties.
127    *
128    * @return non-null reference to the transformer.
129    */

130   public Transformer JavaDoc getTransformer()
131   {
132     return this;
133   }
134
135   /**
136    * Create a result ContentHandler from a Result object, based
137    * on the current OutputProperties.
138    *
139    * @param outputTarget Where the transform result should go,
140    * should not be null.
141    *
142    * @return A valid ContentHandler that will create the
143    * result tree when it is fed SAX events.
144    *
145    * @throws TransformerException
146    */

147   private void createResultContentHandler(Result JavaDoc outputTarget)
148           throws TransformerException JavaDoc
149   {
150
151     if (outputTarget instanceof SAXResult JavaDoc)
152     {
153       SAXResult JavaDoc saxResult = (SAXResult JavaDoc) outputTarget;
154
155       m_resultContentHandler = saxResult.getHandler();
156       m_resultLexicalHandler = saxResult.getLexicalHandler();
157
158       if (m_resultContentHandler instanceof Serializer)
159       {
160
161         // Dubious but needed, I think.
162
m_serializer = (Serializer) m_resultContentHandler;
163       }
164     }
165     else if (outputTarget instanceof DOMResult JavaDoc)
166     {
167       DOMResult JavaDoc domResult = (DOMResult JavaDoc) outputTarget;
168       Node JavaDoc outputNode = domResult.getNode();
169       Document JavaDoc doc;
170       short type;
171
172       if (null != outputNode)
173       {
174         type = outputNode.getNodeType();
175         doc = (Node.DOCUMENT_NODE == type)
176               ? (Document JavaDoc) outputNode : outputNode.getOwnerDocument();
177       }
178       else
179       {
180         try
181         {
182           DocumentBuilderFactory JavaDoc dbf = DocumentBuilderFactory.newInstance();
183
184           dbf.setNamespaceAware(true);
185
186           DocumentBuilder JavaDoc db = dbf.newDocumentBuilder();
187
188           doc = db.newDocument();
189         }
190         catch (ParserConfigurationException JavaDoc pce)
191         {
192           throw new TransformerException JavaDoc(pce);
193         }
194
195         outputNode = doc;
196         type = outputNode.getNodeType();
197
198         ((DOMResult JavaDoc) outputTarget).setNode(outputNode);
199       }
200
201       m_resultContentHandler =
202         (Node.DOCUMENT_FRAGMENT_NODE == type)
203         ? new DOMBuilder(doc, (DocumentFragment JavaDoc) outputNode)
204         : new DOMBuilder(doc, outputNode);
205       m_resultLexicalHandler = (LexicalHandler JavaDoc) m_resultContentHandler;
206     }
207     else if (outputTarget instanceof StreamResult JavaDoc)
208     {
209       StreamResult JavaDoc sresult = (StreamResult JavaDoc) outputTarget;
210       String JavaDoc method = m_outputFormat.getProperty(OutputKeys.METHOD);
211
212       try
213       {
214         Serializer serializer =
215           SerializerFactory.getSerializer(m_outputFormat.getProperties());
216
217         m_serializer = serializer;
218
219         if (null != sresult.getWriter())
220           serializer.setWriter(sresult.getWriter());
221         else if (null != sresult.getOutputStream())
222           serializer.setOutputStream(sresult.getOutputStream());
223         else if (null != sresult.getSystemId())
224         {
225           String JavaDoc fileURL = sresult.getSystemId();
226
227           if (fileURL.startsWith("file:///"))
228           {
229             if (fileURL.substring(8).indexOf(":") >0)
230               fileURL = fileURL.substring(8);
231             else
232               fileURL = fileURL.substring(7);
233           }
234
235           m_outputStream = new java.io.FileOutputStream JavaDoc(fileURL);
236           serializer.setOutputStream(m_outputStream);
237         }
238         else
239           throw new TransformerException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_NO_OUTPUT_SPECIFIED, null)); //"No output specified!");
240

241         m_resultContentHandler = serializer.asContentHandler();
242       }
243       catch (IOException JavaDoc ioe)
244       {
245         throw new TransformerException JavaDoc(ioe);
246       }
247     }
248     else
249     {
250       throw new TransformerException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_TRANSFORM_TO_RESULT_TYPE, new Object JavaDoc[]{outputTarget.getClass().getName()})); //"Can't transform to a Result of type "
251
// + outputTarget.getClass().getName()
252
// + "!");
253
}
254
255     if (m_resultContentHandler instanceof DTDHandler JavaDoc)
256       m_resultDTDHandler = (DTDHandler JavaDoc) m_resultContentHandler;
257     
258     if (m_resultContentHandler instanceof DeclHandler JavaDoc)
259       m_resultDeclHandler = (DeclHandler JavaDoc) m_resultContentHandler;
260
261     if (m_resultContentHandler instanceof LexicalHandler JavaDoc)
262       m_resultLexicalHandler = (LexicalHandler JavaDoc) m_resultContentHandler;
263   }
264
265   /**
266    * Process the source tree to the output result.
267    * @param source The input for the source tree.
268    *
269    * @param outputTarget The output target.
270    *
271    * @throws TransformerException If an unrecoverable error occurs
272    * during the course of the transformation.
273    */

274   public void transform(Source JavaDoc source, Result JavaDoc outputTarget)
275           throws TransformerException JavaDoc
276   {
277
278     createResultContentHandler(outputTarget);
279     
280     /*
281      * According to JAXP1.2, new SAXSource()/StreamSource()
282      * should create an empty input tree, with a default root node.
283      * new DOMSource()creates an empty document using DocumentBuilder.
284      * newDocument(); Use DocumentBuilder.newDocument() for all 3 situations,
285      * since there is no clear spec. how to create an empty tree when
286      * both SAXSource() and StreamSource() are used.
287      */

288     if ((source instanceof StreamSource JavaDoc && source.getSystemId()==null &&
289        ((StreamSource JavaDoc)source).getInputStream()==null &&
290        ((StreamSource JavaDoc)source).getReader()==null)||
291        (source instanceof SAXSource JavaDoc &&
292        ((SAXSource JavaDoc)source).getInputSource()==null &&
293        ((SAXSource JavaDoc)source).getXMLReader()==null )||
294        (source instanceof DOMSource JavaDoc && ((DOMSource JavaDoc)source).getNode()==null)){
295       try {
296         DocumentBuilderFactory JavaDoc builderF = DocumentBuilderFactory.newInstance();
297         DocumentBuilder JavaDoc builder = builderF.newDocumentBuilder();
298         String JavaDoc systemID = source.getSystemId();
299         source = new DOMSource JavaDoc(builder.newDocument());
300
301         // Copy system ID from original, empty Source to new Source
302
if (systemID != null) {
303           source.setSystemId(systemID);
304         }
305       } catch (ParserConfigurationException JavaDoc e){
306         throw new TransformerException JavaDoc(e.getMessage());
307       }
308     }
309     
310     try
311     {
312       if (source instanceof DOMSource JavaDoc)
313       {
314         DOMSource JavaDoc dsource = (DOMSource JavaDoc) source;
315   
316         m_systemID = dsource.getSystemId();
317   
318         Node JavaDoc dNode = dsource.getNode();
319   
320         if (null != dNode)
321         {
322           try
323           {
324             if(dNode.getNodeType() == Node.ATTRIBUTE_NODE)
325               this.startDocument();
326             try
327             {
328               if(dNode.getNodeType() == Node.ATTRIBUTE_NODE)
329               {
330                 String JavaDoc data = dNode.getNodeValue();
331                 char[] chars = data.toCharArray();
332                 characters(chars, 0, chars.length);
333               }
334               else
335               {
336                 TreeWalker walker = new TreeWalker(this, new org.apache.xml.utils.DOM2Helper(), m_systemID);
337                 walker.traverse(dNode);
338               }
339             }
340             finally
341             {
342               if(dNode.getNodeType() == Node.ATTRIBUTE_NODE)
343                 this.endDocument();
344             }
345           }
346           catch (SAXException JavaDoc se)
347           {
348             throw new TransformerException JavaDoc(se);
349           }
350   
351           return;
352         }
353         else
354         {
355           String JavaDoc messageStr = XSLMessages.createMessage(
356             XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null);
357   
358           throw new IllegalArgumentException JavaDoc(messageStr);
359         }
360       }
361   
362       InputSource JavaDoc xmlSource = SAXSource.sourceToInputSource(source);
363   
364       if (null == xmlSource)
365       {
366         throw new TransformerException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_TRANSFORM_SOURCE_TYPE, new Object JavaDoc[]{source.getClass().getName()})); //"Can't transform a Source of type "
367
//+ source.getClass().getName() + "!");
368
}
369   
370       if (null != xmlSource.getSystemId())
371         m_systemID = xmlSource.getSystemId();
372   
373       XMLReader JavaDoc reader = null;
374       boolean managedReader = false;
375   
376       try
377       {
378         if (source instanceof SAXSource JavaDoc) {
379           reader = ((SAXSource JavaDoc) source).getXMLReader();
380         }
381           
382         if (null == reader) {
383           try {
384             reader = XMLReaderManager.getInstance().getXMLReader();
385             managedReader = true;
386           } catch (SAXException JavaDoc se) {
387             throw new TransformerException JavaDoc(se);
388           }
389         } else {
390           try {
391             reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
392                               true);
393           } catch (org.xml.sax.SAXException JavaDoc se) {
394             // We don't care.
395
}
396         }
397
398         // Get the input content handler, which will handle the
399
// parse events and create the source tree.
400
ContentHandler JavaDoc inputHandler = this;
401   
402         reader.setContentHandler(inputHandler);
403   
404         if (inputHandler instanceof org.xml.sax.DTDHandler JavaDoc)
405           reader.setDTDHandler((org.xml.sax.DTDHandler JavaDoc) inputHandler);
406   
407         try
408         {
409           if (inputHandler instanceof org.xml.sax.ext.LexicalHandler JavaDoc)
410             reader.setProperty("http://xml.org/sax/properties/lexical-handler",
411                                inputHandler);
412   
413           if (inputHandler instanceof org.xml.sax.ext.DeclHandler JavaDoc)
414             reader.setProperty(
415               "http://xml.org/sax/properties/declaration-handler",
416               inputHandler);
417         }
418         catch (org.xml.sax.SAXException JavaDoc se){}
419   
420         try
421         {
422           if (inputHandler instanceof org.xml.sax.ext.LexicalHandler JavaDoc)
423             reader.setProperty("http://xml.org/sax/handlers/LexicalHandler",
424                                inputHandler);
425   
426           if (inputHandler instanceof org.xml.sax.ext.DeclHandler JavaDoc)
427             reader.setProperty("http://xml.org/sax/handlers/DeclHandler",
428                                inputHandler);
429         }
430         catch (org.xml.sax.SAXNotRecognizedException JavaDoc snre){}
431   
432         reader.parse(xmlSource);
433       }
434       catch (org.apache.xml.utils.WrappedRuntimeException wre)
435       {
436         Throwable JavaDoc throwable = wre.getException();
437   
438         while (throwable
439                instanceof org.apache.xml.utils.WrappedRuntimeException)
440         {
441           throwable =
442             ((org.apache.xml.utils.WrappedRuntimeException) throwable).getException();
443         }
444   
445         throw new TransformerException JavaDoc(wre.getException());
446       }
447       catch (org.xml.sax.SAXException JavaDoc se)
448       {
449         throw new TransformerException JavaDoc(se);
450       }
451       catch (IOException JavaDoc ioe)
452       {
453         throw new TransformerException JavaDoc(ioe);
454       } finally {
455         if (managedReader) {
456           XMLReaderManager.getInstance().releaseXMLReader(reader);
457         }
458       }
459     }
460     finally
461     {
462       if(null != m_outputStream)
463       {
464         try
465         {
466           m_outputStream.close();
467         }
468         catch(IOException JavaDoc ioe){}
469         m_outputStream = null;
470       }
471     }
472   }
473
474   /**
475    * Add a parameter for the transformation.
476    *
477    * <p>Pass a qualified name as a two-part string, the namespace URI
478    * enclosed in curly braces ({}), followed by the local name. If the
479    * name has a null URL, the String only contain the local name. An
480    * application can safely check for a non-null URI by testing to see if the first
481    * character of the name is a '{' character.</p>
482    * <p>For example, if a URI and local name were obtained from an element
483    * defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
484    * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that
485    * no prefix is used.</p>
486    *
487    * @param name The name of the parameter, which may begin with a namespace URI
488    * in curly braces ({}).
489    * @param value The value object. This can be any valid Java object. It is
490    * up to the processor to provide the proper object coersion or to simply
491    * pass the object on for use in an extension.
492    */

493   public void setParameter(String JavaDoc name, Object JavaDoc value)
494   {
495     if (value == null) {
496       throw new IllegalArgumentException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object JavaDoc[]{name}));
497     }
498     
499     if (null == m_params)
500     {
501       m_params = new Hashtable JavaDoc();
502     }
503
504     m_params.put(name, value);
505   }
506
507   /**
508    * Get a parameter that was explicitly set with setParameter
509    * or setParameters.
510    *
511    * <p>This method does not return a default parameter value, which
512    * cannot be determined until the node context is evaluated during
513    * the transformation process.
514    *
515    *
516    * @param name Name of the parameter.
517    * @return A parameter that has been set with setParameter.
518    */

519   public Object JavaDoc getParameter(String JavaDoc name)
520   {
521
522     if (null == m_params)
523       return null;
524
525     return m_params.get(name);
526   }
527
528   /**
529    * Clear all parameters set with setParameter.
530    */

531   public void clearParameters()
532   {
533
534     if (null == m_params)
535       return;
536
537     m_params.clear();
538   }
539
540   /**
541    * Set an object that will be used to resolve URIs used in
542    * document().
543    *
544    * <p>If the resolver argument is null, the URIResolver value will
545    * be cleared, and the default behavior will be used.</p>
546    *
547    * @param resolver An object that implements the URIResolver interface,
548    * or null.
549    */

550   public void setURIResolver(URIResolver JavaDoc resolver)
551   {
552     m_URIResolver = resolver;
553   }
554
555   /**
556    * Get an object that will be used to resolve URIs used in
557    * document(), etc.
558    *
559    * @return An object that implements the URIResolver interface,
560    * or null.
561    */

562   public URIResolver JavaDoc getURIResolver()
563   {
564     return m_URIResolver;
565   }
566
567   /**
568    * Set the output properties for the transformation. These
569    * properties will override properties set in the Templates
570    * with xsl:output.
571    *
572    * <p>If argument to this function is null, any properties
573    * previously set are removed, and the value will revert to the value
574    * defined in the templates object.</p>
575    *
576    * <p>Pass a qualified property key name as a two-part string, the namespace URI
577    * enclosed in curly braces ({}), followed by the local name. If the
578    * name has a null URL, the String only contain the local name. An
579    * application can safely check for a non-null URI by testing to see if the first
580    * character of the name is a '{' character.</p>
581    * <p>For example, if a URI and local name were obtained from an element
582    * defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
583    * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that
584    * no prefix is used.</p>
585    *
586    * @param oformat A set of output properties that will be
587    * used to override any of the same properties in affect
588    * for the transformation.
589    *
590    * @see javax.xml.transform.OutputKeys
591    * @see java.util.Properties
592    *
593    * @throws IllegalArgumentException if any of the argument keys are not
594    * recognized and are not namespace qualified.
595    */

596   public void setOutputProperties(Properties JavaDoc oformat)
597           throws IllegalArgumentException JavaDoc
598   {
599
600     if (null != oformat)
601     {
602
603       // See if an *explicit* method was set.
604
String JavaDoc method = (String JavaDoc) oformat.get(OutputKeys.METHOD);
605
606       if (null != method)
607         m_outputFormat = new OutputProperties(method);
608       else
609         m_outputFormat = new OutputProperties();
610
611       m_outputFormat.copyFrom(oformat);
612     }
613     else {
614       // if oformat is null JAXP says that any props previously set are removed
615
// and we are to revert back to those in the templates object (i.e. Stylesheet).
616
m_outputFormat = null;
617     }
618   }
619
620   /**
621    * Get a copy of the output properties for the transformation.
622    *
623    * <p>The properties returned should contain properties set by the user,
624    * and properties set by the stylesheet, and these properties
625    * are "defaulted" by default properties specified by <a HREF="http://www.w3.org/TR/xslt#output">section 16 of the
626    * XSL Transformations (XSLT) W3C Recommendation</a>. The properties that
627    * were specifically set by the user or the stylesheet should be in the base
628    * Properties list, while the XSLT default properties that were not
629    * specifically set should be the default Properties list. Thus,
630    * getOutputProperties().getProperty(String key) will obtain any
631    * property in that was set by {@link #setOutputProperty},
632    * {@link #setOutputProperties}, in the stylesheet, <em>or</em> the default
633    * properties, while
634    * getOutputProperties().get(String key) will only retrieve properties
635    * that were explicitly set by {@link #setOutputProperty},
636    * {@link #setOutputProperties}, or in the stylesheet.</p>
637    *
638    * <p>Note that mutation of the Properties object returned will not
639    * effect the properties that the transformation contains.</p>
640    *
641    * <p>If any of the argument keys are not recognized and are not
642    * namespace qualified, the property will be ignored. In other words the
643    * behaviour is not orthogonal with setOutputProperties.</p>
644    *
645    * @return A copy of the set of output properties in effect
646    * for the next transformation.
647    *
648    * @see javax.xml.transform.OutputKeys
649    * @see java.util.Properties
650    */

651   public Properties JavaDoc getOutputProperties()
652   {
653     return (Properties JavaDoc) m_outputFormat.getProperties().clone();
654   }
655
656   /**
657    * Set an output property that will be in effect for the
658    * transformation.
659    *
660    * <p>Pass a qualified property name as a two-part string, the namespace URI
661    * enclosed in curly braces ({}), followed by the local name. If the
662    * name has a null URL, the String only contain the local name. An
663    * application can safely check for a non-null URI by testing to see if the first
664    * character of the name is a '{' character.</p>
665    * <p>For example, if a URI and local name were obtained from an element
666    * defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
667    * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that
668    * no prefix is used.</p>
669    *
670    * <p>The Properties object that was passed to {@link #setOutputProperties} won't
671    * be effected by calling this method.</p>
672    *
673    * @param name A non-null String that specifies an output
674    * property name, which may be namespace qualified.
675    * @param value The non-null string value of the output property.
676    *
677    * @throws IllegalArgumentException If the property is not supported, and is
678    * not qualified with a namespace.
679    *
680    * @see javax.xml.transform.OutputKeys
681    */

682   public void setOutputProperty(String JavaDoc name, String JavaDoc value)
683           throws IllegalArgumentException JavaDoc
684   {
685
686     if (!m_outputFormat.isLegalPropertyKey(name))
687       throw new IllegalArgumentException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object JavaDoc[]{name})); //"output property not recognized: "
688
//+ name);
689

690     m_outputFormat.setProperty(name, value);
691   }
692
693   /**
694    * Get an output property that is in effect for the
695    * transformation. The property specified may be a property
696    * that was set with setOutputProperty, or it may be a
697    * property specified in the stylesheet.
698    *
699    * @param name A non-null String that specifies an output
700    * property name, which may be namespace qualified.
701    *
702    * @return The string value of the output property, or null
703    * if no property was found.
704    *
705    * @throws IllegalArgumentException If the property is not supported.
706    *
707    * @see javax.xml.transform.OutputKeys
708    */

709   public String JavaDoc getOutputProperty(String JavaDoc name) throws IllegalArgumentException JavaDoc
710   {
711
712     String JavaDoc value = null;
713     OutputProperties props = m_outputFormat;
714
715     value = props.getProperty(name);
716
717     if (null == value)
718     {
719       if (!props.isLegalPropertyKey(name))
720         throw new IllegalArgumentException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object JavaDoc[]{name})); //"output property not recognized: "
721
// + name);
722
}
723
724     return value;
725   }
726
727   /**
728    * Set the error event listener in effect for the transformation.
729    *
730    * @param listener The new error listener.
731    * @throws IllegalArgumentException if listener is null.
732    */

733   public void setErrorListener(ErrorListener JavaDoc listener)
734           throws IllegalArgumentException JavaDoc
735   {
736       if (listener == null)
737         throw new IllegalArgumentException JavaDoc(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null));
738       else
739         m_errorListener = listener;
740   }
741
742   /**
743    * Get the error event handler in effect for the transformation.
744    *
745    * @return The current error handler, which should never be null.
746    */

747   public ErrorListener JavaDoc getErrorListener()
748   {
749     return m_errorListener;
750   }
751
752   ////////////////////////////////////////////////////////////////////
753
// Default implementation of DTDHandler interface.
754
////////////////////////////////////////////////////////////////////
755

756   /**
757    * Receive notification of a notation declaration.
758    *
759    * <p>By default, do nothing. Application writers may override this
760    * method in a subclass if they wish to keep track of the notations
761    * declared in a document.</p>
762    *
763    * @param name The notation name.
764    * @param publicId The notation public identifier, or null if not
765    * available.
766    * @param systemId The notation system identifier.
767    * @throws org.xml.sax.SAXException Any SAX exception, possibly
768    * wrapping another exception.
769    * @see org.xml.sax.DTDHandler#notationDecl
770    *
771    * @throws SAXException
772    */

773   public void notationDecl(String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId)
774           throws SAXException JavaDoc
775   {
776     if (null != m_resultDTDHandler)
777       m_resultDTDHandler.notationDecl(name, publicId, systemId);
778   }
779
780   /**
781    * Receive notification of an unparsed entity declaration.
782    *
783    * <p>By default, do nothing. Application writers may override this
784    * method in a subclass to keep track of the unparsed entities
785    * declared in a document.</p>
786    *
787    * @param name The entity name.
788    * @param publicId The entity public identifier, or null if not
789    * available.
790    * @param systemId The entity system identifier.
791    * @param notationName The name of the associated notation.
792    * @throws org.xml.sax.SAXException Any SAX exception, possibly
793    * wrapping another exception.
794    * @see org.xml.sax.DTDHandler#unparsedEntityDecl
795    *
796    * @throws SAXException
797    */

798   public void unparsedEntityDecl(
799           String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId, String JavaDoc notationName)
800             throws SAXException JavaDoc
801   {
802
803     if (null != m_resultDTDHandler)
804       m_resultDTDHandler.unparsedEntityDecl(name, publicId, systemId,
805                                             notationName);
806   }
807
808   ////////////////////////////////////////////////////////////////////
809
// Default implementation of ContentHandler interface.
810
////////////////////////////////////////////////////////////////////
811

812   /**
813    * Receive a Locator object for document events.
814    *
815    * <p>By default, do nothing. Application writers may override this
816    * method in a subclass if they wish to store the locator for use
817    * with other document events.</p>
818    *
819    * @param locator A locator for all SAX document events.
820    * @see org.xml.sax.ContentHandler#setDocumentLocator
821    * @see org.xml.sax.Locator
822    */

823   public void setDocumentLocator(Locator JavaDoc locator)
824   {
825     try
826     {
827       if (null == m_resultContentHandler)
828         createResultContentHandler(m_result);
829     }
830     catch (TransformerException JavaDoc te)
831     {
832       throw new org.apache.xml.utils.WrappedRuntimeException(te);
833     }
834
835     m_resultContentHandler.setDocumentLocator(locator);
836   }
837
838   /**
839    * Receive notification of the beginning of the document.
840    *
841    * <p>By default, do nothing. Application writers may override this
842    * method in a subclass to take specific actions at the beginning
843    * of a document (such as allocating the root node of a tree or
844    * creating an output file).</p>
845    *
846    * @throws org.xml.sax.SAXException Any SAX exception, possibly
847    * wrapping another exception.
848    * @see org.xml.sax.ContentHandler#startDocument
849    *
850    * @throws SAXException
851    */

852   public void startDocument() throws SAXException JavaDoc
853   {
854
855     try
856     {
857       if (null == m_resultContentHandler)
858         createResultContentHandler(m_result);
859     }
860     catch (TransformerException JavaDoc te)
861     {
862       throw new SAXException JavaDoc(te.getMessage(), te);
863     }
864
865     // Reset for multiple transforms with this transformer.
866
m_flushedStartDoc = false;
867     m_foundFirstElement = false;
868   }
869   
870   boolean m_flushedStartDoc = false;
871   
872   protected final void flushStartDoc()
873      throws SAXException JavaDoc
874   {
875     if(!m_flushedStartDoc)
876     {
877       if (m_resultContentHandler == null)
878       {
879         try
880         {
881           createResultContentHandler(m_result);
882         }
883         catch(TransformerException JavaDoc te)
884         {
885             throw new SAXException JavaDoc(te);
886         }
887       }
888       m_resultContentHandler.startDocument();
889       m_flushedStartDoc = true;
890     }
891   }
892
893   /**
894    * Receive notification of the end of the document.
895    *
896    * <p>By default, do nothing. Application writers may override this
897    * method in a subclass to take specific actions at the end
898    * of a document (such as finalising a tree or closing an output
899    * file).</p>
900    *
901    * @throws org.xml.sax.SAXException Any SAX exception, possibly
902    * wrapping another exception.
903    * @see org.xml.sax.ContentHandler#endDocument
904    *
905    * @throws SAXException
906    */

907   public void endDocument() throws SAXException JavaDoc
908   {
909     flushStartDoc();
910     m_resultContentHandler.endDocument();
911   }
912
913   /**
914    * Receive notification of the start of a Namespace mapping.
915    *
916    * <p>By default, do nothing. Application writers may override this
917    * method in a subclass to take specific actions at the start of
918    * each Namespace prefix scope (such as storing the prefix mapping).</p>
919    *
920    * @param prefix The Namespace prefix being declared.
921    * @param uri The Namespace URI mapped to the prefix.
922    * @throws org.xml.sax.SAXException Any SAX exception, possibly
923    * wrapping another exception.
924    * @see org.xml.sax.ContentHandler#startPrefixMapping
925    *
926    * @throws SAXException
927    */

928   public void startPrefixMapping(String JavaDoc prefix, String JavaDoc uri)
929           throws SAXException JavaDoc
930   {
931     flushStartDoc();
932     m_resultContentHandler.startPrefixMapping(prefix, uri);
933   }
934
935   /**
936    * Receive notification of the end of a Namespace mapping.
937    *
938    * <p>By default, do nothing. Application writers may override this
939    * method in a subclass to take specific actions at the end of
940    * each prefix mapping.</p>
941    *
942    * @param prefix The Namespace prefix being declared.
943    * @throws org.xml.sax.SAXException Any SAX exception, possibly
944    * wrapping another exception.
945    * @see org.xml.sax.ContentHandler#endPrefixMapping
946    *
947    * @throws SAXException
948    */

949   public void endPrefixMapping(String JavaDoc prefix) throws SAXException JavaDoc
950   {
951     flushStartDoc();
952     m_resultContentHandler.endPrefixMapping(prefix);
953   }
954
955   /**
956    * Receive notification of the start of an element.
957    *
958    * <p>By default, do nothing. Application writers may override this
959    * method in a subclass to take specific actions at the start of
960    * each element (such as allocating a new tree node or writing
961    * output to a file).</p>
962    *
963    * @param uri The Namespace URI, or the empty string if the
964    * element has no Namespace URI or if Namespace
965    * processing is not being performed.
966    * @param localName The local name (without prefix), or the
967    * empty string if Namespace processing is not being
968    * performed.
969    * @param qName The qualified name (with prefix), or the
970    * empty string if qualified names are not available.
971    * @param attributes The specified or defaulted attributes.
972    * @throws org.xml.sax.SAXException Any SAX exception, possibly
973    * wrapping another exception.
974    * @see org.xml.sax.ContentHandler#startElement
975    *
976    * @throws SAXException
977    */

978   public void startElement(
979           String JavaDoc uri, String JavaDoc localName, String JavaDoc qName, Attributes JavaDoc attributes)
980             throws SAXException JavaDoc
981   {
982
983     if (!m_foundFirstElement && null != m_serializer)
984     {
985       m_foundFirstElement = true;
986
987       Serializer newSerializer;
988
989       try
990       {
991         newSerializer = SerializerSwitcher.switchSerializerIfHTML(uri,
992                 localName, m_outputFormat.getProperties(), m_serializer);
993       }
994       catch (TransformerException JavaDoc te)
995       {
996         throw new SAXException JavaDoc(te);
997       }
998
999       if (newSerializer != m_serializer)
1000      {
1001        try
1002        {
1003          m_resultContentHandler = newSerializer.asContentHandler();
1004        }
1005        catch (IOException JavaDoc ioe) // why?
1006
{
1007          throw new SAXException JavaDoc(ioe);
1008        }
1009
1010        if (m_resultContentHandler instanceof DTDHandler JavaDoc)
1011          m_resultDTDHandler = (DTDHandler JavaDoc) m_resultContentHandler;
1012
1013        if (m_resultContentHandler instanceof LexicalHandler JavaDoc)
1014          m_resultLexicalHandler = (LexicalHandler JavaDoc) m_resultContentHandler;
1015
1016        m_serializer = newSerializer;
1017      }
1018    }
1019    flushStartDoc();
1020    m_resultContentHandler.startElement(uri, localName, qName, attributes);
1021  }
1022
1023  /**
1024   * Receive notification of the end of an element.
1025   *
1026   * <p>By default, do nothing. Application writers may override this
1027   * method in a subclass to take specific actions at the end of
1028   * each element (such as finalising a tree node or writing
1029   * output to a file).</p>
1030   *
1031   * @param uri The Namespace URI, or the empty string if the
1032   * element has no Namespace URI or if Namespace
1033   * processing is not being performed.
1034   * @param localName The local name (without prefix), or the
1035   * empty string if Namespace processing is not being
1036   * performed.
1037   * @param qName The qualified name (with prefix), or the
1038   * empty string if qualified names are not available.
1039   * @param attributes The specified or defaulted attributes.
1040   *
1041   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1042   * wrapping another exception.
1043   * @see org.xml.sax.ContentHandler#endElement
1044   *
1045   * @throws SAXException
1046   */

1047  public void endElement(String JavaDoc uri, String JavaDoc localName, String JavaDoc qName)
1048          throws SAXException JavaDoc
1049  {
1050    m_resultContentHandler.endElement(uri, localName, qName);
1051  }
1052
1053  /**
1054   * Receive notification of character data inside an element.
1055   *
1056   * <p>By default, do nothing. Application writers may override this
1057   * method to take specific actions for each chunk of character data
1058   * (such as adding the data to a node or buffer, or printing it to
1059   * a file).</p>
1060   *
1061   * @param ch The characters.
1062   * @param start The start position in the character array.
1063   * @param length The number of characters to use from the
1064   * character array.
1065   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1066   * wrapping another exception.
1067   * @see org.xml.sax.ContentHandler#characters
1068   *
1069   * @throws SAXException
1070   */

1071  public void characters(char ch[], int start, int length) throws SAXException JavaDoc
1072  {
1073    flushStartDoc();
1074    m_resultContentHandler.characters(ch, start, length);
1075  }
1076
1077  /**
1078   * Receive notification of ignorable whitespace in element content.
1079   *
1080   * <p>By default, do nothing. Application writers may override this
1081   * method to take specific actions for each chunk of ignorable
1082   * whitespace (such as adding data to a node or buffer, or printing
1083   * it to a file).</p>
1084   *
1085   * @param ch The whitespace characters.
1086   * @param start The start position in the character array.
1087   * @param length The number of characters to use from the
1088   * character array.
1089   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1090   * wrapping another exception.
1091   * @see org.xml.sax.ContentHandler#ignorableWhitespace
1092   *
1093   * @throws SAXException
1094   */

1095  public void ignorableWhitespace(char ch[], int start, int length)
1096          throws SAXException JavaDoc
1097  {
1098    m_resultContentHandler.ignorableWhitespace(ch, start, length);
1099  }
1100
1101  /**
1102   * Receive notification of a processing instruction.
1103   *
1104   * <p>By default, do nothing. Application writers may override this
1105   * method in a subclass to take specific actions for each
1106   * processing instruction, such as setting status variables or
1107   * invoking other methods.</p>
1108   *
1109   * @param target The processing instruction target.
1110   * @param data The processing instruction data, or null if
1111   * none is supplied.
1112   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1113   * wrapping another exception.
1114   * @see org.xml.sax.ContentHandler#processingInstruction
1115   *
1116   * @throws SAXException
1117   */

1118  public void processingInstruction(String JavaDoc target, String JavaDoc data)
1119          throws SAXException JavaDoc
1120  {
1121    flushStartDoc();
1122    m_resultContentHandler.processingInstruction(target, data);
1123  }
1124
1125  /**
1126   * Receive notification of a skipped entity.
1127   *
1128   * <p>By default, do nothing. Application writers may override this
1129   * method in a subclass to take specific actions for each
1130   * processing instruction, such as setting status variables or
1131   * invoking other methods.</p>
1132   *
1133   * @param name The name of the skipped entity.
1134   * @throws org.xml.sax.SAXException Any SAX exception, possibly
1135   * wrapping another exception.
1136   * @see org.xml.sax.ContentHandler#processingInstruction
1137   *
1138   * @throws SAXException
1139   */

1140  public void skippedEntity(String JavaDoc name) throws SAXException JavaDoc
1141  {
1142    flushStartDoc();
1143    m_resultContentHandler.skippedEntity(name);
1144  }
1145
1146  /**
1147   * Report the start of DTD declarations, if any.
1148   *
1149   * <p>Any declarations are assumed to be in the internal subset
1150   * unless otherwise indicated by a {@link #startEntity startEntity}
1151   * event.</p>
1152   *
1153   * <p>Note that the start/endDTD events will appear within
1154   * the start/endDocument events from ContentHandler and
1155   * before the first startElement event.</p>
1156   *
1157   * @param name The document type name.
1158   * @param publicId The declared public identifier for the
1159   * external DTD subset, or null if none was declared.
1160   * @param systemId The declared system identifier for the
1161   * external DTD subset, or null if none was declared.
1162   * @throws SAXException The application may raise an
1163   * exception.
1164   * @see #endDTD
1165   * @see #startEntity
1166   */

1167  public void startDTD(String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId)
1168          throws SAXException JavaDoc
1169  {
1170    flushStartDoc();
1171    if (null != m_resultLexicalHandler)
1172      m_resultLexicalHandler.startDTD(name, publicId, systemId);
1173  }
1174
1175  /**
1176   * Report the end of DTD declarations.
1177   *
1178   * @throws SAXException The application may raise an exception.
1179   * @see #startDTD
1180   */

1181  public void endDTD() throws SAXException JavaDoc
1182  {
1183    if (null != m_resultLexicalHandler)
1184      m_resultLexicalHandler.endDTD();
1185  }
1186
1187  /**
1188   * Report the beginning of an entity in content.
1189   *
1190   * <p><strong>NOTE:</entity> entity references in attribute
1191   * values -- and the start and end of the document entity --
1192   * are never reported.</p>
1193   *
1194   * <p>The start and end of the external DTD subset are reported
1195   * using the pseudo-name "[dtd]". All other events must be
1196   * properly nested within start/end entity events.</p>
1197   *
1198   * <p>Note that skipped entities will be reported through the
1199   * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
1200   * event, which is part of the ContentHandler interface.</p>
1201   *
1202   * @param name The name of the entity. If it is a parameter
1203   * entity, the name will begin with '%'.
1204   * @throws SAXException The application may raise an exception.
1205   * @see #endEntity
1206   * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
1207   * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
1208   */

1209  public void startEntity(String JavaDoc name) throws SAXException JavaDoc
1210  {
1211    if (null != m_resultLexicalHandler)
1212      m_resultLexicalHandler.startEntity(name);
1213  }
1214
1215  /**
1216   * Report the end of an entity.
1217   *
1218   * @param name The name of the entity that is ending.
1219   * @throws SAXException The application may raise an exception.
1220   * @see #startEntity
1221   */

1222  public void endEntity(String JavaDoc name) throws SAXException JavaDoc
1223  {
1224    if (null != m_resultLexicalHandler)
1225      m_resultLexicalHandler.endEntity(name);
1226  }
1227
1228  /**
1229   * Report the start of a CDATA section.
1230   *
1231   * <p>The contents of the CDATA section will be reported through
1232   * the regular {@link org.xml.sax.ContentHandler#characters
1233   * characters} event.</p>
1234   *
1235   * @throws SAXException The application may raise an exception.
1236   * @see #endCDATA
1237   */

1238  public void startCDATA() throws SAXException JavaDoc
1239  {
1240    if (null != m_resultLexicalHandler)
1241      m_resultLexicalHandler.startCDATA();
1242  }
1243
1244  /**
1245   * Report the end of a CDATA section.
1246   *
1247   * @throws SAXException The application may raise an exception.
1248   * @see #startCDATA
1249   */

1250  public void endCDATA() throws SAXException JavaDoc
1251  {
1252    if (null != m_resultLexicalHandler)
1253      m_resultLexicalHandler.endCDATA();
1254  }
1255
1256  /**
1257   * Report an XML comment anywhere in the document.
1258   *
1259   * <p>This callback will be used for comments inside or outside the
1260   * document element, including comments in the external DTD
1261   * subset (if read).</p>
1262   *
1263   * @param ch An array holding the characters in the comment.
1264   * @param start The starting position in the array.
1265   * @param length The number of characters to use from the array.
1266   * @throws SAXException The application may raise an exception.
1267   */

1268  public void comment(char ch[], int start, int length) throws SAXException JavaDoc
1269  {
1270    flushStartDoc();
1271    if (null != m_resultLexicalHandler)
1272      m_resultLexicalHandler.comment(ch, start, length);
1273  }
1274  
1275  // Implement DeclHandler
1276

1277  /**
1278     * Report an element type declaration.
1279     *
1280     * <p>The content model will consist of the string "EMPTY", the
1281     * string "ANY", or a parenthesised group, optionally followed
1282     * by an occurrence indicator. The model will be normalized so
1283     * that all whitespace is removed,and will include the enclosing
1284     * parentheses.</p>
1285     *
1286     * @param name The element type name.
1287     * @param model The content model as a normalized string.
1288     * @exception SAXException The application may raise an exception.
1289     */

1290    public void elementDecl (String JavaDoc name, String JavaDoc model)
1291        throws SAXException JavaDoc
1292    {
1293                        if (null != m_resultDeclHandler)
1294                                m_resultDeclHandler.elementDecl(name, model);
1295    }
1296
1297
1298    /**
1299     * Report an attribute type declaration.
1300     *
1301     * <p>Only the effective (first) declaration for an attribute will
1302     * be reported. The type will be one of the strings "CDATA",
1303     * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
1304     * "ENTITIES", or "NOTATION", or a parenthesized token group with
1305     * the separator "|" and all whitespace removed.</p>
1306     *
1307     * @param eName The name of the associated element.
1308     * @param aName The name of the attribute.
1309     * @param type A string representing the attribute type.
1310     * @param valueDefault A string representing the attribute default
1311     * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
1312     * none of these applies.
1313     * @param value A string representing the attribute's default value,
1314     * or null if there is none.
1315     * @exception SAXException The application may raise an exception.
1316     */

1317    public void attributeDecl (String JavaDoc eName,
1318                                        String JavaDoc aName,
1319                                        String JavaDoc type,
1320                                        String JavaDoc valueDefault,
1321                                        String JavaDoc value)
1322        throws SAXException JavaDoc
1323    {
1324      if (null != m_resultDeclHandler)
1325                                m_resultDeclHandler.attributeDecl(eName, aName, type, valueDefault, value);
1326    }
1327
1328
1329    /**
1330     * Report an internal entity declaration.
1331     *
1332     * <p>Only the effective (first) declaration for each entity
1333     * will be reported.</p>
1334     *
1335     * @param name The name of the entity. If it is a parameter
1336     * entity, the name will begin with '%'.
1337     * @param value The replacement text of the entity.
1338     * @exception SAXException The application may raise an exception.
1339     * @see #externalEntityDecl
1340     * @see org.xml.sax.DTDHandler#unparsedEntityDecl
1341     */

1342    public void internalEntityDecl (String JavaDoc name, String JavaDoc value)
1343        throws SAXException JavaDoc
1344    {
1345      if (null != m_resultDeclHandler)
1346                                m_resultDeclHandler.internalEntityDecl(name, value);
1347    }
1348
1349
1350    /**
1351     * Report a parsed external entity declaration.
1352     *
1353     * <p>Only the effective (first) declaration for each entity
1354     * will be reported.</p>
1355     *
1356     * @param name The name of the entity. If it is a parameter
1357     * entity, the name will begin with '%'.
1358     * @param publicId The declared public identifier of the entity, or
1359     * null if none was declared.
1360     * @param systemId The declared system identifier of the entity.
1361     * @exception SAXException The application may raise an exception.
1362     * @see #internalEntityDecl
1363     * @see org.xml.sax.DTDHandler#unparsedEntityDecl
1364     */

1365    public void externalEntityDecl (String JavaDoc name, String JavaDoc publicId,
1366                                             String JavaDoc systemId)
1367        throws SAXException JavaDoc
1368    {
1369      if (null != m_resultDeclHandler)
1370                                m_resultDeclHandler.externalEntityDecl(name, publicId, systemId);
1371    }
1372  
1373  /**
1374   * This is null unless we own the stream.
1375   */

1376  private java.io.FileOutputStream JavaDoc m_outputStream = null;
1377
1378  /** The content handler where result events will be sent. */
1379  private ContentHandler JavaDoc m_resultContentHandler;
1380
1381  /** The lexical handler where result events will be sent. */
1382  private LexicalHandler JavaDoc m_resultLexicalHandler;
1383
1384  /** The DTD handler where result events will be sent. */
1385  private DTDHandler JavaDoc m_resultDTDHandler;
1386  
1387  /** The Decl handler where result events will be sent. */
1388  private DeclHandler JavaDoc m_resultDeclHandler;
1389
1390  /** The Serializer, which may or may not be null. */
1391  private Serializer m_serializer;
1392
1393  /** The Result object. */
1394  private Result JavaDoc m_result;
1395
1396  /**
1397   * The system ID, which is unused, but must be returned to fullfill the
1398   * TransformerHandler interface.
1399   */

1400  private String JavaDoc m_systemID;
1401
1402  /**
1403   * The parameters, which is unused, but must be returned to fullfill the
1404   * Transformer interface.
1405   */

1406  private Hashtable JavaDoc m_params;
1407
1408  /** The error listener for TrAX errors and warnings. */
1409  private ErrorListener JavaDoc m_errorListener =
1410    new org.apache.xml.utils.DefaultErrorHandler();
1411
1412  /**
1413   * The URIResolver, which is unused, but must be returned to fullfill the
1414   * TransformerHandler interface.
1415   */

1416  URIResolver JavaDoc m_URIResolver;
1417
1418  /** The output properties. */
1419  private OutputProperties m_outputFormat;
1420
1421  /** Flag to set if we've found the first element, so we can tell if we have
1422   * to check to see if we should create an HTML serializer. */

1423  boolean m_foundFirstElement;
1424}
1425
Popular Tags