0

This xml parsing code (specifically for RSS feeds) works in Android 7 and 8 but not in 9 and Q beta. setEndTextElementListener is never hit.

    final RootElement root = new RootElement("rss");
    final Element channelNode = root.getChild("channel");

    channelNode.getChild("title").setEndTextElementListener(new EndTextElementListener()
    {
        public void end(final String body) {
            //this is never hit
        }
    });

    try
    {
        final HttpURLConnection conn = (HttpURLConnection)new URL(url).openConnection();
        conn.setReadTimeout(5000);
        conn.setInstanceFollowRedirects(true);

        if (conn.getResponseCode() == 200)
        {
            final InputStream stream = conn.getInputStream();

            Xml.parse(stream, Xml.Encoding.UTF_8, root.getContentHandler());

            stream.close();
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
Kris B
  • 3,436
  • 9
  • 64
  • 106

0 Answers0