0

我正在做一些事情来做圣经中的每日经文,我希望它是随机的。我有一个 xml 的诗句,看起来像这样:

<bible translation="KJV">
<testament name="Old">

    <book name="Genesis">
        <chapter number="1">
            <verse number="1">In the beginning God created the heaven and the earth.</verse>
            <verse number="2">And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.    </verse>

<!-- THE REST OF THE XML HERE -->

                     </chapter>
             </book>
   </testament>

我想使用解析器从其中一节经文中创建一个 NSString 文本,但由于它们都被列出,因为每个元素都可能有几个,并且都以不同的方式命名。关于我如何做到这一点的任何建议?

4

1 回答 1

0

You could use a plist instead of the XML implementation. I find plists easy to implement and manage.

You could load your plist into a dictionary and then randomly select from there.

于 2012-07-01T21:06:00.620 回答