XmlDocument doc= new XmlDocument();
doc.Load("D:\test.xml");
XmlNode xmlNode = doc.SelectSingleNode("si");
xTemp= xmlNode.Attributes["id"].InnerText;
string xTemp = string.Empty;
XmlDocument testXML = new XmlDocument();
testXML.Load("D:\\aaa.xml");
XmlNamespaceManager xnm = new XmlNamespaceManager(testXML.NameTable);
XmlNode xmlNode = testXML.SelectSingleNode("script/si");
xTemp = xmlNode.Attributes["id"].InnerText;
已测试!
XmlDocument doc = new XmlDocument();
string strFileName = @"D:\test.xml";
doc.Load(strFileName);
XmlNode xmlNode = doc.GetElementsByTagName("id");
string value= nodeName[0].InnerText;
未将对象引用的对象的实例,说明你那个地方取出来得内容为Null
请你把代码贴出来,好做进一步分析