--- android/Side9/src/dk/thoerup/side9/Side9Xml.java 2010/06/15 13:16:29 853 +++ android/Side9/src/dk/thoerup/side9/Side9Xml.java 2010/06/16 07:40:59 854 @@ -11,6 +11,10 @@ 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; @@ -28,6 +32,7 @@ public static Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + return builder.parse( new ByteArrayInputStream(str.getBytes()) ); } @@ -35,6 +40,8 @@ public static byte[] getContent(String uri) throws IOException { byte buffer[] = new byte[256]; + + ByteArrayOutputStream baos = new ByteArrayOutputStream(32768); //start buffer size - instead of default 32bytes URL url = new URL(uri); @@ -62,6 +69,8 @@ byte data[] = getContent( dataURL ); String xmlData = new String(data, "ISO-8859-1"); + xmlData = xmlData.replace("encoding=\"ISO-8859-1\"", ""); + Document doc = parseXML(xmlData); Node rootNode = doc.getDocumentElement(); // stations