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>

パーサーを使用して、詩の1つからテキストのNSStringを作成したいと思いますが、それらはすべてリストされているため、これらの要素のそれぞれがいくつか存在する可能性があり、すべて異なる名前が付けられています。これをどのように行うことができるかについての提案はありますか?

4

1 に答える 1

0

XML実装の代わりにplistを使用できます。plistは実装と管理が簡単だと思います。

plistを辞書にロードし、そこからランダムに選択することができます。

于 2012-07-01T21:06:00.620 に答える