简体   繁体   中英

iPhone: repeating Elements in XML

I am new to XML parsing. I am parsing the following XML. There are tutorials for if XML has unique attributes but this XML has repeating attributes.

<?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.

I agree with SB's comment, if you wan't to handle xml-datastructurse, you should know at least the basic stuff.

A good tutorial i can reccomend is ww3 schools XML Tutorial

once you did that, you should know that there are several ways to parse xml files. For flatfiles i recommend to use the TBXML Library , it is really fast and easy to handle within your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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