0
Reply

C# parsing .XSPF (XML)

Lasse Ahti

Lasse Ahti

Jan 11 2016 7:44 PM
451
i have a playlist that i need to parse.
 but i dont know how i could get the "title"(folder) and "tid"(id) so that i would have them in groups  like this :
BillyJ  0,1,2,3,4,5,6...
Solo 60,61,62,63,64..
Best 105,106,107
 
here is the .xspf 
  1.     <?xml version="1.0" encoding="UTF-8"?>  
  2.     <playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1">  
  3.         <title>Playlist</title>  
  4.         <trackList>  
  5.             <track>  
  6.                 <location>file:///E:/Downloads/video1.mp4</location>  
  7.                 <duration>681493</duration>  
  8.                 <extension application="http://www.videolan.org/vlc/playlist/0">  
  9.                     <vlc:id>0</vlc:id>  
  10.                 </extension>  
  11.             </track>  
  12.             <track>  
  13.                 <location>file:///E:/Downloads/video2.mp4</location>  
  14.                 <duration>614585</duration>  
  15.                 <extension application="http://www.videolan.org/vlc/playlist/0">  
  16.                     <vlc:id>1</vlc:id>  
  17.                 </extension>  
  18.             </track>  
  19.             <track>  
  20.                 <location>file:///E:/Downloads/video3.mp4</location>  
  21.                 <duration>220629</duration>  
  22.                 <extension application="http://www.videolan.org/vlc/playlist/0">  
  23.                     <vlc:id>2</vlc:id>  
  24.                 </extension>  
  25.             </track>        
  26.         </trackList>  
  27.         <extension application="http://www.videolan.org/vlc/playlist/0" xmlns="http://xspf.org/ns/0/">  
  28.     <vlc:node title="1111.xspf" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/">  
  29.         <vlc:node title="BillyJ">  
  30.             <vlc:item tid="0" />  
  31.             <vlc:item tid="1" />  
  32.             <vlc:item tid="2" />  
  33.             <vlc:item tid="3" />  
  34.             <vlc:item tid="4" />  
  35.             <vlc:item tid="5" />  
  36.             <vlc:item tid="6" />  
  37.             <vlc:item tid="7" />  
  38.             <vlc:item tid="8" />  
  39.             <vlc:item tid="9" />  
  40.             <vlc:item tid="10" />  
  41.             <vlc:item tid="57" />  
  42.             <vlc:item tid="58" />  
  43.             <vlc:item tid="59" />  
  44.         </vlc:node>  
  45.         <vlc:node title="Solo">  
  46.             <vlc:item tid="60" />  
  47.             <vlc:item tid="61" />  
  48.             <vlc:item tid="62" />  
  49.             <vlc:item tid="63" />  
  50.             <vlc:item tid="64" />  
  51.             <vlc:item tid="65" />  
  52.             <vlc:item tid="66" />  
  53.             <vlc:item tid="67" />  
  54.             <vlc:item tid="102" />  
  55.             <vlc:item tid="103" />  
  56.             <vlc:item tid="104" />  
  57.         </vlc:node>  
  58.         <vlc:node title="Best">  
  59.             <vlc:item tid="105" />  
  60.             <vlc:item tid="106" />  
  61.             <vlc:item tid="107" />  
  62.             <vlc:item tid="108" />  
  63.             <vlc:item tid="109" />  
  64.             <vlc:item tid="110" />  
  65.             <vlc:item tid="111" />  
  66.         </vlc:node>  
  67.         </vlc:node>  
  68. </extension>  
  69. </playlist> 
 i have parsed the first part of the file the "location" "duration" and " id".
But yeah like i said im stuck and dont know how i would do it . i can get all the titles and all the tids but they need to be grouped(nested)  like in the playlist