KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > xsl > TransformerHandlerImpl


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.xsl;
30
31 import com.caucho.log.Log;
32 import com.caucho.util.L10N;
33 import com.caucho.xml.DOMBuilder;
34 import com.caucho.xml.QDocument;
35
36 import org.w3c.dom.Node JavaDoc;
37 import org.xml.sax.SAXException JavaDoc;
38
39 import javax.xml.transform.Result JavaDoc;
40 import javax.xml.transform.TransformerException JavaDoc;
41 import javax.xml.transform.dom.DOMSource JavaDoc;
42 import javax.xml.transform.sax.TransformerHandler JavaDoc;
43 import java.util.logging.Level JavaDoc;
44 import java.util.logging.Logger JavaDoc;
45
46 public class TransformerHandlerImpl extends DOMBuilder
47   implements TransformerHandler JavaDoc {
48   protected static final Logger JavaDoc log = Log.open(TransformerHandlerImpl.class);
49   protected static final L10N L = new L10N(TransformerHandlerImpl.class);
50   
51   private javax.xml.transform.Transformer JavaDoc _transformer;
52   private Result JavaDoc _result;
53   
54   TransformerHandlerImpl(javax.xml.transform.Transformer JavaDoc transformer)
55   {
56     _transformer = transformer;
57
58     init(new QDocument());
59   }
60
61   public String JavaDoc getSystemId()
62   {
63     return "asdf";
64   }
65
66   public javax.xml.transform.Transformer JavaDoc getTransformer()
67   {
68     return _transformer;
69   }
70
71   public void setResult(Result JavaDoc result)
72   {
73     _result = result;
74   }
75
76   public void endDocument()
77     throws SAXException JavaDoc
78   {
79     super.endDocument();
80
81     Node JavaDoc node = getNode();
82     DOMSource JavaDoc source = new DOMSource JavaDoc(node);
83
84     try {
85       ((TransformerImpl) _transformer).transform(source, _result);
86     } catch (TransformerException JavaDoc e) {
87       log.log(Level.WARNING, e.toString(), e);
88     }
89   }
90
91   public void notationDecl(String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId)
92   {
93   }
94   
95   public void unparsedEntityDecl(String JavaDoc name, String JavaDoc publicId,
96                                  String JavaDoc systemId, String JavaDoc notationName)
97   {
98   }
99   
100   public void startDTD(String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId)
101     throws SAXException JavaDoc
102   {
103   }
104   
105   public void endDTD()
106     throws SAXException JavaDoc
107   {
108   }
109   
110   public void startEntity(String JavaDoc name)
111     throws SAXException JavaDoc
112   {
113   }
114   
115   public void endEntity(String JavaDoc name)
116     throws SAXException JavaDoc
117   {
118   }
119   
120   public void startCDATA()
121     throws SAXException JavaDoc
122   {
123   }
124   
125   public void endCDATA()
126     throws SAXException JavaDoc
127   {
128   }
129 }
130
Popular Tags