Android:最好的 XML 解析库?

发布于 2024-09-27 19:12:00 字数 77 浏览 1 评论 0原文

我必须在 Android 应用程序中解析一些复杂的 xml 文件。有没有什么好的库可以做到这一点,比如 iPhone 的 TouchXMl?

I have to parse some complex xml files inside my Android application. Is there any good library for doing that like there is TouchXMl for iPhone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萌辣 2024-10-04 19:12:00

或者您可以使用 org.xmlpull.v1.XmlPullParser - 我发现它比 SAX 解析器更容易使用,并且它还有其他好处:

http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html

http://www.bearcave.com/software/java/xml/xmlpull.html

Or you could use the org.xmlpull.v1.XmlPullParser - I've found it much easier to use than the SAX Parser and it has other benefits:

http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html

http://www.bearcave.com/software/java/xml/xmlpull.html

仅此而已 2024-10-04 19:12:00

SAX XML 解析器 已内置于 Android SDK 中。

The SAX XML Parser comes already built into the Android SDK.

剩一世无双 2024-10-04 19:12:00

使用Woodstox。它是一个 Stax pull 解析器,实际上支持所有 XML(与捆绑的 xmlpull 不同),高效、成熟。为了更方便,StaxMate 也有帮助,使用 Woodstox(或任何其他 Stax 解析器)进行解析,但公开方便的游标和编写器;但仍然比 DOM 方法快 3 倍到 5 倍。

提到的 XmlPullParser 在某种程度上可以工作,但无法处理 DTD(不仅是验证,甚至是基本字符实体),给出神秘的错误消息,并且没有标准接口(SAX 或 Stax)。

Use Woodstox. It's a Stax pull parser, actually supports all of XML (unlike xmlpull that is bundled), efficient, mature. For more convenience, StaxMate helps too, uses Woodstox (or any other Stax parser) for parsing but exposes convenient cursors and writers; but is still 3x - 5x faster than DOM approach.

XmlPullParser that was mentioned works to some degree, but can't handle DTDs (not just validation but even basic character entities), gives cryptic error messages and doesn't have standard interface (SAX or Stax).

反差帅 2024-10-04 19:12:00

不知道定义“最佳”的标准。但这里有一篇最近的研究论文,详细分析了现有的 java xml 框架...

http://recipp.ipp.pt/bitstream/10400.22/1847/1/ART_BrunoOliveira_2013.pdf

Don't know the criteria by which "best" is defined. but here is a recent research paper that analyzes existing java xml framework with great details...

http://recipp.ipp.pt/bitstream/10400.22/1847/1/ART_BrunoOliveira_2013.pdf

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文