RSS 피드를 http://b.fanfiction.net/atom/l/224/3/0/1/1/50/0/0/0/0에서 구문 분석하려고하지만 어떤 이유로 요소 이름으로 검색 할 수 없습니다. 나는 this page에서 지침을 따르고 있지만 그의 예는 위의 fanfiction 사이트에서 작동하지 않는 것 같습니다. 난 그냥 모든 요소 및 문서의 하위 요소를 나열 시도RSS 피드를 구문 분석 할 수 없음
private void getData_Click(object sender, RoutedEventArgs e)
{
String rss = "http://b.fanfiction.net/atom/l/224/3/0/1/1/50/0/0/0/0";
HttpWebRequest request = HttpWebRequest.CreateHttp(rss);
request.BeginGetResponse(
asyncCallback =>
{
string data = null;
using (WebResponse response = request.EndGetResponse(asyncCallback))
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
data = reader.ReadToEnd();
}
}
Deployment.Current.Dispatcher.BeginInvoke(() => HttpsCompleted(data));
}
, null);
}
private void HttpsCompleted(string feedString)
{
// build XML DOM from feed string
XDocument doc = XDocument.Parse(feedString);
// show title of feed in TextBlock
XElement feed = doc.Element("feed");
XElement title = feed.Element("title");
String txt_title = title.Value;
txtBlk_FeedDescription.Text = txt_title;
// add each feed item to a ListBox
foreach (var item in doc.Descendants("entry"))
{
listBox1.Items.Add(item.Element("title").Value);
}
}
실행하여 : 여기
내가 사용하고 코드의foreach (XElement element in doc.Elements())
{
txtBlk_FeedDescription.Text += element.Name.ToString() + "\n";
foreach (XElement subelement in element.Elements())
{
txtBlk_FeedDescription.Text += subelement.Name.ToString() + "\n";
}
}
그리고 그 다음 목록에 결과 :
{http://www.w3.org/2005/Atom은}
{,582,385,393,632 공급 10} 저작
{http://www.w3.org/2005/Atom} 표제
{http://www.w3.org/2005/Atom} 자막
{http://www.w3.org/2005/Atom} 링크
{http://www.w3.org/2005/Atom} 업데이트
{http://www.w3.org/2005/Atom} ID
{http://www.w3.org/2005/Atom} 입력
01 23,516,{http://www.w3.org/2005/Atom} 항목
{http://www.w3.org/2005/Atom} 항목
...
내가 여기 어떻게해야 해요 무엇에 어떤 도움?
감사합니다.