选择正确的IOS XML解析器 [英] Choosing the right IOS XML parser

查看:134
本文介绍了选择正确的IOS XML解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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-chose-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆