2

I have a problem parsing a xml file. I'm working on two devices: A S4 mini with API 19 and a S7 with API 23. With the S7 everything is working fine, but with the S4 I get this error:

org.xml.sax.SAXParseException: Unexpected token (position:TEXT
 �������������\Ys9...@1:143 in java.io.InputStreamReader@428187a8)

 at   W/System.err:     at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
 at  W/System.err:     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
 at W/System.err:     at com.example.entwicklung1.designtestapp.ReadRssZander.Getdata(ReadRssZander.java:108)

I found, that many people had the same problem but i couldn't find any solution. I'm trying to understand the errorThe error. Am I right, that it looks like there ary character, that the parser can not encode? If yes, are there other possibilitys to parse the file and return a document?

Error can be here:

public Document Getdata(){
        try {
            url = new URL(adress);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            InputStream inputStrem = connection.getInputStream();
            DocumentBuilderFactory builderFactory=DocumentBuilderFactory.newInstance();
            DocumentBuilder builder=builderFactory.newDocumentBuilder();
            Document xmlDoc =builder.parse(inputStrem);
            return xmlDoc;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

The XML file: https://www.zander-aachen.de/share/rss-de.xml

What am I doing wrong? can anyone help me please?

Koss
  • 124
  • 2
  • 13

0 Answers0