Search code examples
androidxmlrssandroid-contentprovider

Android - broken XML parsing example


Android SDK since release of API v. 11 contains XmlAdapter sample which is also referenced from the official site. This sample appears now in at least 3 folders: android-11, android-12 and android-13. And it is broken. The main (but not only) problem it declares android.content.XmlDocumentProvider provider which is nowhere to be found including https://android.googlesource.com
There are also compilation problems in Adapters.java:

mContext cannot be resolved to a variable   line 973
mFrom cannot be resolved to a variable  line 938
mTo cannot be resolved to a variable    line 937
mTo cannot be resolved to a variable    line 939

There are few question related to this on android-developers but no answer. Did anyone managed to track this elusive XmlDocumentProvider and make the sample work? And most importantly - dear Android team, can you ether fix the sample or pull it out?


Solution

  • The missing XmlDocumentProvider is now shipping with the sample in SDK 14 and the project compiles against SDK 8 and above. To run it successfully however, you must modify the manifest to point to the correct provider:

    <provider android:name="com.example.android.xmladapters.XmlDocumentProvider"
           android:authorities="xmldocument" />