Qual a melhor maneira??
XML Parser ou Expressões Regulares?
Não me dei muito bem com o XML Parser, então fui tentar com expressões regulares e não estou conseguindo sair deste problema:
<video_list> <video> <author>youtuberocks</author> <id>k0gEeue2sLk</id> <!-- this ID can be used with youtube.videos.get_details --> <title>My First Motion Picture</title> <length_seconds>16</length_seconds> <!-- length of video --> <rating_avg>3.75</rating_avg> <rating_count>10</rating_count> <description>This is the video description shown on the YouTube site.</description> <view_count>170</view_count> <upload_time>1121398533</upload_time> <!-- UNIX-style time, secs since 1/1/1970 --> <comment_count>1</comment_count> <!-- how many comments does this video have? --> <tags>feature film documentary</tags> <url>http://www.youtube.com/watch?v=k04Eeue24Lk</url> <thumbnail_url>http://static.youtube.com/get_still?video_id=k04Eeue24Lk</thumbnail_url> </video> <video> ... another video ... </video> </video_list>
O XML é baseado nesse esquema.
Eu não estou conseguindo separar cada informação contida entre cada tag (<tag> INFO </tag>)
Já tentei:
/<video>(.+)<\/video>/
Mas não funciona muito bem!