blob: e90777161a24f09a4887f1950ac9f4e49c7a50a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package org.apache.tuscany.sca.impl.io;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
public class XMLReader {
//get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
private Document dom;
public Document parseXMLFile(String file) throws Exception
{
//Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
//parse using builder to get DOM representation of the XML file
dom = db.parse(file);
return dom;
}
}
|