ISSUE 1).
I had to add the following to my build.gradle. Since these packages come with Android already, so there were problems.
compile ('com.squareup.retrofit:converter-simplexml:1.9.0') { exclude group: 'xpp3', module: 'xpp3' exclude group: 'stax', module: 'stax-api' exclude group: 'stax', module: 'stax' }
ISSUE 2).
I had to have a Java class hierarchy, which should start with the first element that is in XML. I had "Rss" as the first element in my XML. And although I generated the schemas using http://pojo.sodhanalibrary.com/Convert , I gave my name, something like "Warnings", which generated classes for all the necessary elements. Warnings.java had an instance of "Rss". Instead of skipping Rss, I passed Warnings for an upgrade.
Class Warnings { private Rss rss; ..... ..... } Class Rss { private Channel channel; ..... ..... }
To some extent, he can find the class hierarchy, but he began to give the errors / exceptions mentioned in the question for all fields of all classes, although they seem to be available. After quite a bit of time spent fixing these errors, I changed the response class that was passed to retrofit.Callback from Warnings to Rss, and it worked.
XML:
<rss version="2.0"> <channel>...</channel> </rss>
This was my modification request code with errors:
retrofitService.getWarnings(lat, lon, authKey, new Callback<Warnings>() { @Override public void success(WarningsResponse warningsResponse, Response response) {
Work code:
retrofitService.getWarnings(lat, lon, authKey, new Callback<Rss>() { @Override public void success(WarningsResponse warningsResponse, Response response) {
The only diff is the class passed in for the callback.
So, use the root element class name in XML to jump to the callback so that the conversion of XML objects to Java is easily successful.
You can find this discussion in XML integration using the Retrofit help site:
https://futurestud.io/blog/retrofit-how-to-integrate-xml-converter/