KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wsdl > util > Utils


1 /*
2  * Copyright 2004,2005 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 package org.apache.wsdl.util;
17
18 import org.w3c.dom.Document JavaDoc;
19 import org.xml.sax.SAXException JavaDoc;
20
21 import javax.xml.parsers.DocumentBuilder JavaDoc;
22 import javax.xml.parsers.DocumentBuilderFactory JavaDoc;
23 import javax.xml.parsers.ParserConfigurationException JavaDoc;
24 import java.io.IOException JavaDoc;
25 import java.io.InputStream JavaDoc;
26
27 /**
28  * @author Srinath Perera(hemapani@opensource.lk)
29  */

30 public class Utils {
31     /**
32      * Method newDocument
33      *
34      * @param in
35      * @return
36      * @throws ParserConfigurationException
37      * @throws SAXException
38      * @throws IOException
39      */

40     public static Document JavaDoc newDocument(InputStream JavaDoc in)
41             throws ParserConfigurationException JavaDoc, SAXException JavaDoc, IOException JavaDoc {
42         DocumentBuilderFactory JavaDoc dbf = DocumentBuilderFactory.newInstance();
43         dbf.setNamespaceAware(true);
44         DocumentBuilder JavaDoc db = dbf.newDocumentBuilder();
45         return db.parse(in);
46     }
47 }
48
Popular Tags