KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > wsdl > util > XSLTTemplateProcessor


1 package org.apache.axis2.wsdl.util;
2
3
4 import javax.xml.transform.*;
5 import javax.xml.transform.stream.StreamResult JavaDoc;
6 import javax.xml.transform.stream.StreamSource JavaDoc;
7 import java.io.InputStream JavaDoc;
8 import java.io.OutputStream JavaDoc;
9
10
11 /*
12  * Copyright 2004,2005 The Apache Software Foundation.
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * The XSLT template processor
27  * this is based on the JDK built in transformers
28  */

29 public class XSLTTemplateProcessor {
30
31     /**
32      * Parses an XML stream with an XSL stream
33      * @param out Stream to write the output
34      * @param xmlStream Source XML stream
35      * @param xsltStream Source XSL stream
36      * @throws TransformerFactoryConfigurationError
37      * @throws TransformerException
38      */

39     public static void parse(OutputStream JavaDoc out,InputStream JavaDoc xmlStream,InputStream JavaDoc xsltStream)
40             throws TransformerFactoryConfigurationError,TransformerException {
41             Source JavaDoc xmlSource = new StreamSource JavaDoc(xmlStream);
42             Source JavaDoc xsltSource = new StreamSource JavaDoc(xsltStream);
43             Result JavaDoc result = new StreamResult JavaDoc(out);
44             Transformer transformer = TransformerFactory.newInstance().newTransformer(xsltSource);
45             transformer.transform(xmlSource, result);
46
47     }
48
49
50
51 }
52
Popular Tags