开发者

Do I have to use XML parsing or any other way of saving the server response

I am getting the following response from server:

    <?xml version="1.0" encoding="UTF-8"?>
 <tracks type="array">
    <track>
        <id type="integer">13082503</id>
        <created-at type="datetime">2011-04-05T05:48:05Z</created-at>
        <user-id type="integer">2796383</user-id>
        <duration type="integer">6715</duration>
        <commentable type="boolean">true</commentable>
        <state>finished</state>
        <sharing>public</sharing>
        <tag-list />
        <permalink>myfirstsong-tutorial1-6</permalink>
        <description nil="true" />
        <streamable type="boolean">true</streamable>
        <downloadable type="boolean">false</downloadable>
        <genre nil="true" />
        <release nil="true" />
        <purchase-url nil="true" />
        <label-id nil="true" />
        <label-name nil="true" />
        <isrc nil="true" />
        <video-url nil="true" />
        <track-type nil="true" />
        <key-signature nil="true" />
        <bpm nil="true" />
        <title>MyFirstSong-Tutorial1</title>
        <release-year nil="true" />
        <release-month nil="true" />
        <release-day nil="true" />
        <original-format>m4a</original-format>
        <license>all-rights-reserved</license>
        <uri>http://api.soundcloud.com/tracks/13082503</uri>
        <permalink-url>http://soundcloud.com/sleuth007/myfirstsong-tutorial1-6</permalink-url>
        <artwork-url nil="true" />
        <waveform-url>http:/开发者_StackOverflow社区/w1.sndcdn.com/8MqNbtkeyhNZ_m.png</waveform-url>
        <user>
          <id type="integer">2796383</id>
          <permalink>sleuth007</permalink>
          <username>sleuth007</username>
          <uri>http://api.soundcloud.com/users/2796383</uri>
          <permalink-url>http://soundcloud.com/sleuth007</permalink-url>
          <avatar-url>http://a1.sndcdn.com/images/default_avatar_large.png?5fb6c47</avatar-url>
        </user>
        <stream-url>http://api.soundcloud.com/tracks/13082503/stream</stream-url>
        <downloads-remaining type="integer">100</downloads-remaining>
        <secret-token>s-5vz60</secret-token>
        <secret-uri>http://api.soundcloud.com/tracks/13082503?secret_token=s-5vz60</secret-uri>
        <user-playback-count type="integer">1</user-playback-count>
        <user-favorite type="boolean">false</user-favorite>
        <playback-count type="integer">0</playback-count>
        <download-count type="integer">0</download-count>
        <favoritings-count type="integer">0</favoritings-count>
        <comment-count type="integer">0</comment-count>
        <created-with>
          <id type="integer">61</id>
          <name>Cocoa API Wrapper Test</name>
          <uri>http://api.soundcloud.com/apps/61</uri>
          <permalink-url>http://soundcloud.com/apps/cocoa-api-wrapper-test</permalink-url>
        </created-with>
        <attachments-uri>http://api.soundcloud.com/tracks/13082503/attachments</attachments-uri> 
</track>
 </tracks>

Do I have to do XML parsing for this or is there any other way to save this as array


You will have to use NSXMLParser for parsing the xml file. "type=array" is XML attribute and not an array.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜