1 |
package dk.thoerup.traininfo.util;
|
2 |
|
3 |
import java.io.ByteArrayInputStream;
|
4 |
import java.io.IOException;
|
5 |
|
6 |
import javax.xml.parsers.DocumentBuilder;
|
7 |
import javax.xml.parsers.DocumentBuilderFactory;
|
8 |
import javax.xml.parsers.ParserConfigurationException;
|
9 |
|
10 |
import org.w3c.dom.Document;
|
11 |
import org.xml.sax.SAXException;
|
12 |
|
13 |
public class XmlUtil {
|
14 |
public static Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException
|
15 |
{
|
16 |
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
17 |
return builder.parse( new ByteArrayInputStream(str.getBytes()) );
|
18 |
}
|
19 |
}
|