你好,我有這個鏈接XML。我需要採取所有項目並打印出項目guid值(網址發佈)。我在這段代碼中做錯了什麼?它打印出空行而不是內容。我在這裏做錯了什麼 - 打印出XML guid值
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader("http://lazhalazha.livejournal.com/data/rss");
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name == "guid")
{
Console.WriteLine(reader.Value); // Prints out empty strings instead of URL
}
}
}
Console.WriteLine("end.");
Console.ReadLine();
}
此外,在打印2行,當我們看到,我有3項與GUID在其中,這是爲什麼?
Okey,它工作得很好,但你能幫我解決第二個問題嗎?爲什麼它只打印出2個帖子的網址,當我明顯有3 – sed 2012-03-03 16:57:51
@Qmal:我在鏈接的XML中只看到** 2 **''節點。 –
2012-03-03 16:58:36
啊,第三個是私人的,只提供給我。謝啦。 – sed 2012-03-03 17:06:08