1 |
package dk.thoerup.traininfo.util; |
package dk.thoerup.traininfo.util; |
2 |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
import java.io.IOException; |
|
3 |
|
|
|
import javax.xml.parsers.DocumentBuilder; |
|
|
import javax.xml.parsers.DocumentBuilderFactory; |
|
|
import javax.xml.parsers.ParserConfigurationException; |
|
|
|
|
|
import org.w3c.dom.Document; |
|
|
import org.xml.sax.SAXException; |
|
4 |
|
|
5 |
public class XmlUtil { |
public class XmlUtil { |
6 |
|
|
7 |
public static final String SERVICE_BASE = "http://app.t-hoerup.dk/TrainInfoService"; |
public static final String SERVICE_BASE = "http://app.t-hoerup.dk/TrainInfoService"; |
8 |
|
|
|
public static Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException |
|
|
{ |
|
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
|
|
return builder.parse( new ByteArrayInputStream(str.getBytes()) ); |
|
|
} |
|
9 |
} |
} |