0
我正在努力从KJV XML文件中显示随机的圣经经文,但我在XML格式化方面遇到了一些问题,因为它基本上有许多数组。它有这样的格式:iOS从XML文件中抓取随机文本
<?xml version="1.0"?>
<bible translation="King James Version">
<testament name="Old">
<book name="Genesis">
<chapter number="1">
<verse number="1">
</verse>
</chapter>
</book>
</testament>
</bible>
我试图得到这个转换为一个plist文件,以更好地处理它,但我遇到了在这一方面的问题也是如此。我用了一个在线程序将其转换为JSON文件,但使用plutil
时从终端转换为plist
文件,我得到以下错误:
Unexpected character { at line 1/JSON error: No string key for value in object around character 1.
JSON格式看起来像这样的前几行:
{
"bible": {
"-translation": "King James Version",
"testament": [
{
"-name": "Old",
"book": [
{
"-name": "Genesis",
"chapter": [
{
"-number": "1",
"verse": [
{
"-number": "1",
"#text": "In the beginning God created the heaven and the earth."
},
我将不胜感激任何建议,无论是在这个转换为plist
文件,或使其使用XML。