iPhone SDK RSS Parser - Traversing XML

Discussion in 'iOS Programming' started by computerartist, Sep 4, 2010.

  1. computerartist macrumors newbie

    Joined:
    Sep 4, 2010
    #1
    I have used iPhone SDK parsers and am kind of familiar with the programming and the options.

    My question is how to traverse an XML file with the following structure:

    Code:
    <election name="Latest Election Polls">
        <poll date="Sat, 04 Sep 2010 15:36:44 -0500" pollster="Chicago Tribune" race="Illinois Governor - Brady vs. Quinn" year="2010" type="Governor" state="IL" poll_id="1361" spread="Brady +5.0">
            <candidate name="Brady" affiliation="Republican" value="37"/>
            <candidate name="Quinn" affiliation="Democrat" value="32"/>
        </poll>
    </election>
    

    ???
     
  2. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #2
  3. computerartist thread starter macrumors newbie

    Joined:
    Sep 4, 2010
    #3
    for:

    Code:
    <election name="Latest Election Polls">
        <poll date="Sat, 04 Sep 2010 15:36:44 -0500" pollster="Chicago Tribune" race="Illinois Governor - Brady vs. Quinn" year="2010" type="Governor" state="IL" poll_id="1361" spread="Brady +5.0">
            <candidate name="Brady" affiliation="Republican" value="37"/>
            <candidate name="Quinn" affiliation="Democrat" value="32"/>
        </poll>
    </election>

    How do I display?:

    candidate >> name
    candidate >> affiliation
    candidate >> value
     
  4. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
    parserDidStartElement: includes a dictionary of attributes for each element (attributeDict).
     
  5. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #5
    You might want to step back and read a little more about xml, objective c, and NSXMLParser. You can display the information however you want.
     

Share This Page