我無法弄清楚如何在Android中獲取適當的XML結構。Android XML資源文件的正確結構
我已將recepies.xml保存到值文件夾中,並且想要分析它們。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recepies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<recepie name="recepie1">
<item></item>
<NumberOfPersons>1</NumberOfPersons>
<Ingredients>
<string></string>
<string></string>
</Ingredients>
<Preparation></Preparation>
<Energy>342</Energy>
<Protein>8</Protein>
<RecipeCategory>3</RecipeCategory>
</recepie>
但是,我得到或 「無效的開始標記」,如果我沒有recipies標籤這樣的格式化
:
<?xml version="1.0" encoding="UTF-8" standalone="yes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?>
我得到的,沒有更多的僞屬性允許。
如果我只用這樣的:
<?xml version="1.0" encoding="UTF-8"?>
我得到的標記的格式不正確。
我想我錯過了XML格式的基礎知識,但我無法弄清楚什麼。
是的......我認爲有一些邊界可以遵循...... Tnx – Balkyto