2
<?xml version="1.0" encoding="utf-8"?>
<response list="true">
<audio>
<aid>253663595</aid>
<artist>Example</artist>
<duration>389</duration>
<lyrics_id>57485771</lyrics_id>
<genre>18</genre>
</audio>
<audio>
<aid>253663595</aid>
<artist>Example1</artist>
<duration>400</duration>
<lyrics_id>57485772</lyrics_id>
<genre>20</genre>
</audio>
</response>
的源代碼XML解析器不起作用
XmlDocument allAudio = new XmlDocument();
allAudio.Load(@"e:\Audio.xml");
StreamWriter write_text = File.CreateText(@"e:\Audio.txt");
XmlNodeList audioNodes = allAudio.GetElementsByTagName("audio");
foreach (XmlNode audioNode in audioNodes)
{
XmlNode artistNode = audioNode["artist"];
write_text.WriteLine(String.Format("{0}", artistNode.Value));
}
write_text.Close();
您好,我無法解析XML。我想在文件中寫入一些節點值,但結果我得到一個空的txt文件。
什麼編程語言是第二塊意思是什麼? – Chris
這種語言是c#。 – jenius