开发者

How to pass on a value after parsing the same elementname a few times

开发者 https://www.devze.com 2023-02-25 09:33 出处:网络
I need some guidance about XML parsing. in my case I have to parse XML it looks like <volunteerphotos>

I need some guidance about XML parsing. in my case I have to parse XML it looks like

<volunteerphotos>
    <event eventid="684"><title>Compton Ave Church of Christ </title>
        <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/r634382175227818785.jpg</photo>
        <description></description>
        <childphotos>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382175498447249844.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382175531416421141.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/63438217556032304132.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382175591104685110.jpg</photo>
        </childphotos>
    </event>
    <event eventid="678">
        <title>USC Marshall Business School Community Service Day </title>
        <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/r634382069855729838.jpg</photo>
        <description></description>
        <childphotos>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382070719490894949.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382070752616318261.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382070793554342355.jpg</photo>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382070832304838230.jpg</p开发者_如何学JAVAhoto>
            <photo>http://www.lafoodbank.org/thumbnailfile.aspx?width=160&path=source/VolunteerEvent/634382070866680278668.jpg</photo>
        </childphotos>
    </event>
</volunteerphotos>

Here, same name tag is used but i confused how can i stored accessed in next view. Any suggestion....!!!!


Something that really helped me in my application, and a lot of other people, is to do this tutorial entirely. It lets you understand the basics of XML parsing.

After doing the tutorial (including programming! No lazy reading only ;) ), try to program the parser into your app.

After that, come back to SO if you still don't understand things.

EDIT: I understand your main problem is to give the (selected) value to another view. In that case, you should set your secondView.value (NSDictionary).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号