选择正确的 IOS XML 解析器 [英] Choosing the right IOS XML parser
问题描述
iPhone 有上百万种不同的 XML 解析器.我有一个中等大小的 XML 文件,其中包含大量重复标签(在层次结构的不同点).我在考虑 TBXML,但我担心它缺乏 XPath 支持.例如,假设我的 XML 文件看起来像这样.
There are a million different XML parsers for the iPhone. I have a medium sized XML file that contains alot of duplicate tags (at different points in the hierarchy). I was thinking about TBXML but I was concerned about its lack of XPath support. For instance lets say my XML file looked like this.
<blog>
<author> foo1 </author>
<comments>
<comment>
<text>
<![CDATA[ HTML code that must be extracted ]]>
</text>
<author>foo2</author>
</comment>
<comment>
<text>
<![CDATA[ Here is another post ]]>
</text>
<author>foo1</author>
</comment>
</comments>
</blog>
基本上我的要求是我需要能够提取该 cdata.并且知道是不是博客作者是评论作者.
Basically my requirements are that I need to be able to extract that cdata. And know whether it is the blog author a comment author.
推荐答案
我见过的关于该主题的最佳比较:
Best comparison I've seen on the subject:
http://www.raywenderlich.com/553/how-to-choose-the-best-xml-parser-for-your-iphone-project
在他的案例中,最慢和最快的解析器之间的差异是 2 倍.根据您的功能要求,肯定有解析器可以将您的解析时间减少一半.
The difference between the slowest and fastest parsers in his case was a factor of 2. Depending on your feature requirements, there are definitely parsers that can cut your parsing time in half.
这篇关于选择正确的 IOS XML 解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!