简体   繁体   中英

Android RSS Reader - Tutorial error

I have spent the day researching Android RSS Readers.

I would like to parse a very simple XML file in my app. http://www.sportinglife.com/rss/transfer_wire.xml

There are several threads on this site answering RSS questions, such as https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android . I have tried all the solutions in this but I keep getting errors in Eclipse when running the code.

I have found a recent IBM Tutorial from April 2012, which explains the code very well and offers a solution in just one class file. http://www.ibm.com/developerworks/xml/library/x-androidxml/index.html

I have followed this tutorial step by step, but Eclipse throws the following error:

[Dex Loader] Unable to execute dex: Unexpected magic: [100, 101, 120, 10, 48, 49, 51, 0]
[FootballTransfers] Conversion to Dalvik format failed: Unable to execute dex: Unexpected magic: [100, 101, 120, 10, 48, 49, 51, 0]

Has anybody encountered this problem before? I have no idea what this error means.

I get the same error when I run the solutions offered in the https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android thread.

pass inputstream instead of urls

 @Override
        protected Void doInBackground(String... urls) {

 arrayList = new NewsParser().getData(NewsMainActivity .this.getResources.openRawResourece(R.xml.feed));

            return null;
        }

and in getData method change parameter to InputStream.

 public List<NewsBean> getData(InputStream istream) {
    DocumentBuilder builder = DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder();

            System.out.println("Builder : " + builder);

            Document doc = builder.parse(istream);
    Document doc = builder.parse(istream);
.....
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM