0
내가 내가이 방법에서 XML을 구문 분석하고 있습니다 ... 문제가 있습니다윈도우 폰 구문 분석 XML은 (같은 <media:group>가)
public MainPage(){
InitializeComponent();
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
Uri url = new Uri("http://gdata.youtube.com/feeds/api/users/my_channel/uploads/?alt=rss&prettyprint=true", UriKind.Absolute);
client.OpenReadAsync(url);
}
public void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e){
try{
var xml=XDocument.Load(e.Result);
var results=from row in xml.Element("rss").Element("channel").Elements().Where(element=>{
return(element.Name.LocalName == "item");
})select row;
List<MioVideo> videoList = new List<MioVideo>();
int totalevideo = 0;
foreach (var result in results){
XElement title=result.Elements().Where(element => {
return element.Name.LocalName == "title";
}).FirstOrDefault();
XElement description = result.Elements().Where(element =>
{
return element.Name.LocalName == "description";
}).FirstOrDefault();
XElement mylink = result.Elements().Where(element =>
{
return element.Name.LocalName == "link";
}).FirstOrDefault();
String id_video = mylink.Value;
id_video = id_video.Substring(31,11);
videoList.Add(new MioVideo(title.Value, description.Value, mylink.Value,"http://img.youtube.com/vi/"+id_video+"/hqdefault.jpg"));
totalevideo++;
}
listavideo.ItemsSource = videoList;
}
catch (Exception c){
MessageBox.Show(c.Message);
}
}
내가 다른 노드를 구문 분석하고 싶지만, 그것을이있는 이름처럼, 나는 그것을 파싱하고 yt : duration 내부의 값을 검색하는 방법을 모른다.
다른 사람이 내게 줄 수 있습니까 ???
<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:app='http://purl.org/atom/app#' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007' version='2.0'>
<channel>
<description></description>
<atom:id>http://gdata.youtube.com/feeds/api/users/mychannel/uploads</atom:id>
<lastBuildDate>Tue, 03 Jan 2012 12:24:02 +0000</lastBuildDate>
<category domain='http://schemas.google.com/g/2005#kind'>http://gdata.youtube.com/schemas/2007#video</category>
<title>Uploads by MyChannel</title>
<image>
<url>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</url>
<title>Uploads by MyChannel</title>
<link>http://www.youtube.com/profile?user=MyChannel#p/u</link>
</image>
<link>http://www.youtube.com/profile?user=MyChannel#p/u</link>
<atom:link rel='self' href='http://gdata.youtube.com/feeds/api/users/MyChannel/uploads?alt=rss&start-index=1&max-results=25'/>
<managingEditor>MyChannel</managingEditor>
<generator>YouTube data API</generator>
<openSearch:totalResults>75</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<item>
<guid isPermaLink='false'>http://gdata.youtube.com/feeds/api/videos/Qt6wF29Ytzo</guid>
<pubDate>Fri, 23 Dec 2011 12:10:17 +0000</pubDate>
<atom:updated>2011-12-23T13:22:34.000Z</atom:updated>
<category domain='http://schemas.google.com/g/2005#kind'>http://gdata.youtube.com/schemas/2007#video</category>
<category domain='http://gdata.youtube.com/schemas/2007/categories.cat'>Comedy</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>Natale</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>paolo</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>labati</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>auguri</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>comicità</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>italiana</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>mychannel</category>
<category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>MyChannel</category>
<title>mio video</title>
<description>Tanti auguri di Buon Natale!!!</description>
<link>http://www.youtube.com/watch?v=Qt6wF29Ytzo&feature=youtube_gdata</link>
<author>MyChannel</author>
<gd:comments>
<gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/Qt6wF29Ytzo/comments' countHint='0'/>
</gd:comments>
<media:group>
<media:category label='Commedie' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>Comedy</media:category>
<media:content url='http://www.youtube.com/v/Qt6wF29Ytzo?version=3&f=user_uploads&app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='17' yt:format='5'/>
<media:content url='rtsp://v4.cache4.c.youtube.com/CigLENy73wIaHwk6t1hvF7DeQhMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='17' yt:format='1'/>
<media:content url='rtsp://v3.cache5.c.youtube.com/CigLENy73wIaHwk6t1hvF7DeQhMYESARFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='17' yt:format='6'/>
<media:description type='plain'>Tanti auguri di Buon Natale!!!</media:description>
<media:keywords>Natale, paolo, labati, auguri, comicità, italiana, mychannel, MyChannel</media:keywords>
<media:player url='http://www.youtube.com/watch?v=Qt6wF29Ytzo&feature=youtube_gdata_player'/>
<media:thumbnail url='http://i.ytimg.com/vi/Qt6wF29Ytzo/0.jpg' height='360' width='480' time='00:00:08.500'/>
<media:thumbnail url='http://i.ytimg.com/vi/Qt6wF29Ytzo/1.jpg' height='90' width='120' time='00:00:04.250'/>
<media:thumbnail url='http://i.ytimg.com/vi/Qt6wF29Ytzo/2.jpg' height='90' width='120' time='00:00:08.500'/>
<media:thumbnail url='http://i.ytimg.com/vi/Qt6wF29Ytzo/3.jpg' height='90' width='120' time='00:00:12.750'/>
<media:title type='plain'>Paolo Labati - Buon Natale</media:title>
<yt:duration seconds='17'/>
</media:group>
<yt:statistics favoriteCount='1' viewCount='432'/>
</item>
</channel>
</rss>
와 나는 YT에서 값을 검색해야합니다 : 다른 단어
, 내 XML은 기간과 미디어 : 썸네일
미안하지만 내 코드로 예제를 만들 수 있습니까? 나는 이해하지 못한다. 나는 wp7에 새로왔다. – Zak
@Zak이 업데이트되었다. 위로 –
을 찾으십시오. responseElement에 대한 오류를 검색합니다. 현재 컨텍스트에 존재하지 않습니다. – Zak