简体   繁体   English

iPhone:在XML中重复元素

[英]iPhone: repeating Elements in XML

I am new to XML parsing. 我是XML解析的新手。 I am parsing the following XML. 我正在解析以下XML。 There are tutorials for if XML has unique attributes but this XML has repeating attributes. 如果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>

I need to fetch the low and high values based on the years 2005 and 2006. 我需要根据2005和2006年得出低值和高值。

I agree with SB's comment, if you wan't to handle xml-datastructurse, you should know at least the basic stuff. 我同意SB的评论,如果您不想处理xml-datastructurse,则至少应该了解基本知识。

A good tutorial i can reccomend is ww3 schools XML Tutorial 我可以推荐的一个很好的教程是ww3 school XML教程

once you did that, you should know that there are several ways to parse xml files. 完成此操作后,您应该知道有几种解析xml文件的方法。 For flatfiles i recommend to use the TBXML Library , it is really fast and easy to handle within your code. 对于平面文件,我建议使用TBXML库 ,它在您的代码中确实非常快速便捷。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM