[英]iPhone: repeating Elements in XML
我是XML解析的新手。 我正在解析以下XML。 如果XML具有唯一屬性,但該XML具有重復屬性,則有一些教程。
<?xml version="1.0" encoding="utf-8"?>
<start>
<Period periodType="A" fYear="2005" endCalYear="2005" endMonth="3">
<ConsEstimate type="High">
<ConsValue dateType="CURR">-8.9919</ConsValue>
</ConsEstimate>
<ConsEstimate type="Low">
<ConsValue dateType="CURR">-13.1581</ConsValue>
</ConsEstimate>
</Period>
< Period periodType="A" fYear="2006" endCalYear="2006" endMonth="3">
<ConsEstimate type="High">
<ConsValue dateType="CURR">-100.000</ConsValue>
</ConsEstimate>
<ConsEstimate type="Low">
<ConsValue dateType="CURR">-13.1581</ConsValue>
</ConsEstimate>
</Period>
</start>
我需要根據2005和2006年得出低值和高值。
我同意SB的評論,如果您不想處理xml-datastructurse,則至少應該了解基本知識。
我可以推薦的一個很好的教程是ww3 school XML教程
完成此操作后,您應該知道有幾種解析xml文件的方法。 對於平面文件,我建議使用TBXML庫 ,它在您的代碼中確實非常快速便捷。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.