--- android/Side9/src/dk/thoerup/side9/Side9Xml.java 2010/06/16 07:40:59 854 +++ android/Side9/src/dk/thoerup/side9/Side9Xml.java 2010/06/16 07:44:42 855 @@ -11,10 +11,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; + import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -29,11 +26,11 @@ static final int WIDTH = 450; static final String BASEURL = "http://apps.todic.net/side9/"; - public static Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException + public static Document parseXML(byte data[]) throws SAXException, IOException, ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - return builder.parse( new ByteArrayInputStream(str.getBytes()) ); + return builder.parse( new ByteArrayInputStream( data) ); } @@ -67,11 +64,8 @@ public static Side9Data loadXml() throws IOException, ParserConfigurationException, SAXException{ String dataURL = BASEURL + "xml.php?width=" + WIDTH; - byte data[] = getContent( dataURL ); - String xmlData = new String(data, "ISO-8859-1"); - xmlData = xmlData.replace("encoding=\"ISO-8859-1\"", ""); - - Document doc = parseXML(xmlData); + byte data[] = getContent( dataURL ); + Document doc = parseXML( data ); Node rootNode = doc.getDocumentElement(); // stations NodeList nodes = rootNode.getChildNodes();