以前没用过C# 现在需要做点东西碰到难题大家帮帮忙
现在已读到xml文件想取得<z:row text="sdafasdf" ID="92" />行"sdafasdf"这个值
还想在这行的下面加一条新记录在保存一个新xml文件
XML code<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly" rs:updatable="true">
<s:AttributeType name="text" rs:number="1">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="8" rs:maybenull="false" />
</s:AttributeType>
<s:AttributeType name="ID" rs:number="2" rs:basecatalog="temp" rs:basetable="oa" rs:basecolumn="ID" rs:keycolumn="true" rs:hidden="true" rs:autoincrement="true">
<s:datatype dt:type="int" dt:maxLength="4" rs:precision="10" rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
<s:extends type="rs:rowbase" />
</s:ElementType>
</s:Schema>
<rs:data>
<z:row text="sdafasdf" ID="92" />
</rs:data>
</xml>
C# code string filename = "C:/Users/Administrator/Desktop/sdafsdfa";
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filename);
XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(xmldoc.NameTable);
xmlnsManager.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
XmlNodeList nodes = xmldoc.SelectNodes("//rs:data", xmlnsManager);
C# codeXmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filename);
XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(xmldoc.NameTable);
xmlnsManager.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
XmlNode root = xmldoc.SelectSingleNode("//rs:data", xmlnsManager);
XmlElement xe1 = xmldoc.CreateElement("z","row","z:row");//创建一个<z:row>节点
xe1.SetAttribute("text", "李赞红");//设置该节点text属性
xe1.SetAttribute("ID", "93");//设置该节点ID属性
root.AppendChild(xe1);
xmldoc.Save(filename);
XmlDocument xm1 = new XmlDocument();//创建XML文件
string path = AppDomain.CurrentDomain.BaseDirectory + "userinfo.xml";
xm1.Load(path);
bool LoginRight = false;
XmlNode xn1 = xm1.SelectSingleNode("userinfo/admin[@text='" + TextBox1.Text + "']");
if (xn1 != null)
{