我对XmlReader.Read()输出感到困惑。希望有人能解释一下。
似乎XmlReader.Read()方法总是给一个额外的空行?
以下是我的代码:
public static void TestXML()
{
XmlReader r = XmlReader.Create(@"d:\snapshot_skeleton.xml");
//r.MoveToContent();
while (r.Read())
{
Console.Write(new String('.', r.Depth));
Console.WriteLine(r.Name);
}
}
以下是输出:
xml
<-----------------what is this?
person
. <-----------------what is this?
.name
.. <-----------------what is this?
.name
.
.gender
..
.gender
.
.age
..
.age
.
person