2016-06-21 43 views
0

我是xml解析的新手。我想分析我想從中提取專輯名稱的波紋管xml,即AlbumName 照片(專輯名稱是照片)。有人請幫助我。我正在使用nsopenpanel獲取xml路徑。從xml獲得鍵值對osx

<plist version="1.0"> 
<dict> 
    <key>Application Version</key> 
    <string>9.4</string> 
    <key>Archive Path</key> 
    <string>/Users/betterlabs/Pictures/iPhoto Library.photolibrary</string> 
    <key>ArchiveId</key> 
    <string>1</string> 
    <key>Major Version</key> 
    <integer>2</integer> 
    <key>Minor Version</key> 
    <integer>0</integer> 
    <key>List of Albums</key> 
    <array> 
     <dict> 
      <key>AlbumId</key> 
      <integer>4</integer> 
      <key>AlbumName</key> 
      <string>Photos</string> 
      <key>Album Type</key> 
      <string>99</string> 
      <key>GUID</key> 
      <string>allPhotosAlbum</string> 
      <key>Master</key><true/> 
      <key>KeyList</key> 
      <array> 
       <string>1</string> 
       <string>5</string> 
       <string>3</string> 
       <string>7</string> 
       <string>9</string> 
       <string>27</string> 
       <string>23</string> 
       <string>25</string> 
       <string>21</string> 
       <string>19</string> 
       <string>17</string> 
       <string>15</string> 
       <string>13</string> 
       <string>11</string> 
       <string>29</string> 
       <string>33</string> 
       <string>31</string> 
      </array> 
      <key>PhotoCount</key> 
      <integer>17</integer> 
     </dict> 

回答

0

使用XMLDictionary。它將解析你的數據/字符串對象並給你一個可用的NSDictionary。