Best approach for XML parsing on the iPhone

前端 未结 3 630
终归单人心
终归单人心 2020-12-02 17:46

I\'ve familiarized myself with the NSXMLParser from the iPhone SDK but I find the event-driven nature of it awkward for my purposes. I just want to extract some element valu

3条回答
  •  再見小時候
    2020-12-02 18:35

    Repurposing the code from Seismic XML provides a very good API that creates NSObject subclasses from XML.

    If the advice is to just work with NSXMLParser, are there certain design patterns I can use to keep my code from having 5 levels of nested ifs in the startElement method?

    I depends on what you are trying to do. You could put your element names in a dictionary and take action based on the relevant object in a dictionary - this is effectively what SeismicXML does.

提交回复
热议问题