KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > echo > Echo


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

30
31 /**
32  * Author : Deepal Jayasinghe
33  * Date: May 30, 2005
34  * Time: 1:12:11 PM
35  */

36 public class Echo {
37
38     public Echo() {
39     }
40     public OMElement viewVersion(OMElement omEle) {
41         File JavaDoc aFile = new File JavaDoc("E:\\TestCase\\Soap.txt");
42         FileInputStream JavaDoc inputFile = null; //Place to store the input stream reference
43
try {
44             inputFile = new FileInputStream JavaDoc(aFile);
45             XMLStreamReader xmlr =
46                     null;
47
48             xmlr = XMLInputFactory.newInstance().createXMLStreamReader(inputFile);
49             OMXMLParserWrapper builder =
50                     OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlr);
51             OMElement doc = builder.getDocumentElement();
52             doc.build();
53             return doc;
54         }catch(Exception JavaDoc e) {
55             return null;
56         }
57
58     }
59
60 }
Popular Tags