【发布时间】:2009-07-31 12:35:03
【问题描述】:
让我尽可能清楚地解释这个问题的确切含义。
xml 看起来像这样
<Books>
<Book id="1">
<title>Circumference</title>
<author>Nicholas Nicastro</author>
<summary>Eratosthenes and the Ancient Quest to Measure the Globe.</summary>
</Book>
<Book id="2">
<title>Copernicus Secret</title>
<author>Jack Repcheck</author>
<summary>How the scientific revolution began</summary>
</Book>
</Books>
它看起来像这样
<Books>
<Book id="1">
<title>Circumference</title>
<author>Nicholas Nicastro</author>
<summary id ='1'>Eratosthenes and the Ancient Quest to Measure the Globe.</summary>
<summary id ='2'>Eratosthenes more info in another tag.</summary>
<summary id ='3'>Eratosthenes and again another tag.</summary>
<summary id ='4'>Eratosthenes and the final tag another one here</summary>
</Book>
<Book id="2">
<title>Copernicus Secret</title>
<author>Jack Repcheck</author>
<summary id ='1'>How the scientific revolution began</summary>
<summary id ='2'>Eratosthenes more info in another tag.</summary>
<summary id ='3'>Eratosthenes and again another tag.</summary>
<summary id ='4'>Eratosthenes and the final tag another one here</summary>
</Book>
</Books>
现在,如果我按照上面列出的网站上的说明进行操作,它不会解释如何处理摘要 2、3、4(我需要解析的 xml 看起来像那样)以及如何显示它们的输出。我将得到的只是最后一行。有没有人知道我如何才能得到其他的(在这种情况下意味着 2,3 它似乎只显示最后一个,因为这可能是 currentElementValue 中的最后一个)。
我有点困惑,我是不是也必须在这里解决这个属性,还是应该在我的解析器中创建一个新的搜索标签?
【问题讨论】:
标签: objective-c xml parsing