循环。XmlTextReader reader = new XmlTextReader(...);
while (reader.Read())
{
if (reader.GetAttribute("starttime") != null)
{
// reader.GetAttribute("starttime")
}
}
while (reader.Read())
{
if (reader.GetAttribute("starttime") != null)
{
// reader.GetAttribute("starttime")
}
}
xmlReader = new XmlTextReader(Application.StartupPath + "\\config.xml");
while(xmlReader.Read())
{
if(xmlReader.NodeType == XmlNodeType.Element)
{
if(xmlReader.LocalName == "timezone")
{
MessageBox.Show(xmlReader.GetAttribute("starttime"));
}
}
}
这样写怎么不能读第二个starttime呀?只能读第一个starttime!!!