0 Replies Latest reply on Jul 18, 2007 7:02 AM by Goo101

    XPath problem

    Goo101 Level 1
      Hi All,
      I have following XML . . .

      <plist version="1.0">
      <dict>
      <key>Major Version</key><integer>1</integer>
      <key>Minor Version</key><integer>1</integer>
      <key>Application Version</key><string>7.3</string>
      <key>Features</key><integer>1</integer>
      <key>Show Content Ratings</key><true/>
      <key>Music Folder</key><string>file://localhost/C:/Documents%20and%20Settings/Miceal/My%20Documents/ My%20Music/iTunes/iTunes%20Music/</string>
      <key>Library Persistent ID</key><string>3CE588FBF58AC44D</string>
      <key>Tracks</key>
      <dict>
      <key>67</key>
      <dict>
      <key>Track ID</key><integer>67</integer>
      <key>Name</key><string>My Weakness</string>
      <key>Artist</key><string>Moby</string>
      <key>Album Artist</key><string>Moby</string>
      <key>Composer</key><string>Moby</string>
      <key>Album</key><string>Play</string>
      <key>Genre</key><string>Rock</string>
      <key>Kind</key><string>MPEG audio file</string>
      <key>Size</key><integer>5491546</integer>
      <key>Total Time</key><integer>217600</integer>
      <key>Track Number</key><integer>18</integer>
      <key>Year</key><integer>1999</integer>
      <key>Date Modified</key><date>2007-06-29T15:41:20Z</date>
      <key>Date Added</key><date>2007-07-13T15:59:59Z</date>
      <key>Bit Rate</key><integer>201</integer>
      <key>Sample Rate</key><integer>44100</integer>
      <key>Persistent ID</key><string>E4FCCFFE82EF88F4</string>
      <key>Track Type</key><string>File</string>
      <key>Location</key><string>file://localhost/C:/Documents%20and%20Settings/Miceal/My%20Doc uments/Music/Moby%20-%20Play%20%5B1999%5D/18%20-%20My%20Weakness.mp3</string>
      <key>File Folder Count</key><integer>-1</integer>
      <key>Library Folder Count</key><integer>-1</integer>
      </dict>
      <key>68</key>
      <dict>
      <key>Track ID</key><integer>68</integer>
      <key>Name</key><string>Honey</string>
      <key>Artist</key><string>Moby</string>
      <key>Album Artist</key><string>Moby</string>
      <key>Composer</key><string>Moby</string>
      <key>Album</key><string>Play</string>
      <key>Genre</key><string>Rock</string>
      <key>Kind</key><string>MPEG audio file</string>
      <key>Size</key><integer>4423590</integer>
      <key>Total Time</key><integer>208718</integer>
      <key>Track Number</key><integer>1</integer>
      <key>Year</key><integer>1999</integer>
      <key>Date Modified</key><date>2007-06-29T15:41:16Z</date>
      <key>Date Added</key><date>2007-07-13T15:59:59Z</date>
      <key>Bit Rate</key><integer>169</integer>
      <key>Sample Rate</key><integer>44100</integer>
      <key>Persistent ID</key><string>E4FCCFFE82EF88F6</string>
      <key>Track Type</key><string>File</string>
      <key>Location</key><string>file://localhost/C:/Documents%20and%20Settings/Miceal/My%20Doc uments/Music/Moby%20-%20Play%20%5B1999%5D/01%20-%20Honey.mp3</string>
      <key>File Folder Count</key><integer>-1</integer>
      <key>Library Folder Count</key><integer>-1</integer>
      </dict>


      And I'm trying to use the XPathAPI along with a predicate expression to find every occurrance of the key with the value 'Persistent ID'. I have been trying the following syntax but no mater how I change it I'm getting a "null" value as a return . . .

      var xmlPID:XMLNode = XPathAPI.selectSingleNode(xmlRoot.firstChild, "dict/dict/dict/key[@key='Persistent ID']");
      trace(xmlPID);


      Can anyone identify what is wrong with this syntax? (or XML data drill down for that matter)? I understand that the 'key' nodes text values are in fact node names but I still need to know how to access the string value given for the Persistent ID field . . . any help would be greatly appreciated!