Android - 损坏的 XML 解析示例
自 API v. 11 发布以来,Android SDK 包含 XmlAdapter 示例,也引用自官方网站。该示例现在至少出现在 3 个文件夹中:android-11、android-12 和 android-13。它已经坏了。它声明的主要(但不仅仅是)问题 android.content.XmlDocumentProvider
提供程序无处可寻,包括 https://android.googlesource.comAdapters.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
android-developers
上有几个与此相关的问题,但没有答案。有人设法跟踪这个难以捉摸的 XmlDocumentProvider
并使示例正常工作吗? 最重要的是 - 亲爱的 Android 团队,您能修复示例或将其取出吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
缺少的
XmlDocumentProvider
现在随 SDK 14 中的示例一起提供,并且该项目针对 SDK 8 及更高版本进行编译。但是,要成功运行它,您必须修改清单以指向正确的提供程序: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:除了修复 Jeff Gilfelt 指出的 AndroidManifest.xml 之外,您还可以更改 Adapters.java 中的代码 XmlCursorAdapter 类(显示错误的文件),如下所示:
我从此处找到的代码中得到了答案:
Besides fixing the AndroidManifest.xml as pointed out by Jeff Gilfelt, you can also change the code XmlCursorAdapter class in Adapters.java (the file showing the errors) like this:
I got the answer from the code found here:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/example/android/xmladapters/Adapters.java?av=f
我得到了罗曼·盖伊的答复,嗯。我昨天打开的票现在有一个标签状态:FutureRelease,我想这意味着他们将在下一个版本中修复它。如需添加参考,请参阅 android-developers 上的讨论链接
I got answer from Romain Guy, well sort of. The ticket that I opened yesterday now has a tag Status: FutureRelease which I suppose means that they will fix it in the next release. For the added reference here's link to the discussion on android-developers
我遇到了同样的错误并四处搜索,发现同样的问题已被问了很多次。我就是这样解决的。
有一个
XmlDocumentProvider
类 我发现。我将
XmlDocumentProvider.java
复制到XmlAdapter
项目中,并修改了AndroidManifest.xml
,将: 替换为:
现在我能够获得 <代码>RssReaderActivity 工作。
I met the same error and searched around, found the same question has been asked for many times. This is how I fixed it.
There is a
XmlDocumentProvider
class I found.I copied the
XmlDocumentProvider.java
into theXmlAdapter
project and revised theAndroidManifest.xml
by replacing:with:
Now I am able to get the
RssReaderActivity
working.