xml parse - new to obj-c

Discussion in 'iOS Programming' started by eatsubway, Jul 15, 2009.

  1. eatsubway macrumors newbie

    Joined:
    Jul 15, 2009
    #1
    Hello,

    I am brand new to obj-c and iphone development. What code would I need to use, in order to parse the following XML data. Such as assign this XML to a variable and then use XMLparser to parse it, then print it out using NSLog. I would greatly appreciate it if I could have the code exactly so it would be as simple as copying and pasting into a console application (ie including the main method). thanks.

    <recipe name="bread" prep_time="5 mins" cook_time="3 hours">
    <title>Basic bread</title>
    <ingredient amount="8" unit="dL">Flour</ingredient>
    <ingredient amount="10" unit="grams">Yeast</ingredient>
    <ingredient amount="4" unit="dL" state="warm">Water</ingredient>
    <ingredient amount="1" unit="teaspoon">Salt</ingredient>
    <instructions>
    <step>Mix all ingredients together.</step>
    <step>Knead thoroughly.</step>
    <step>Cover with a cloth, and leave for one hour in warm room.</step>
    <step>Knead again.</step>
    <step>Place in a bread baking tin.</step>
    <step>Cover with a cloth, and leave for one hour in warm room.</step>
    <step>Bake in the oven at 180(degrees)C for 30 minutes.</step>
    </instructions>
    </recipe>
     

Share This Page