app教程网 综合百科 读取xml的路径是(xmldocument读取xml)

读取xml的路径是(xmldocument读取xml)

# regionTwo用于读写xml文件的两个小函数,2005年4月2日,作者hyc。

AppValue是value { XML文档xDoc=新XML文档();xDoc .加载(XML路径);XmlNode xNodeXmlElement xelem 1 XML element xele m2

xNode=xDoc.SelectSingleNode('//appSettings');

xElem1=(XmlElement)xNode.SelectSingleNode('//add[@key='' + AppKey + '']');if ( xElem1 !=null ){xElem1.SetAttribute('value',AppValue);}else{xElem2=xDoc.CreateElement('add');xElem2.SetAttribute('key',AppKey);xElem2.SetAttribute('value',AppValue);xNode.AppendChild(xElem2);}xDoc.Save(xmlPath);}

AppValue是value { XML文档xDoc=新XML文档();xDoc .加载(XML路径);XmlNode xNodeXmlElement xElem1

xNode=xDoc.SelectSingleNode('//appSettings');

xElem1=(XmlElement)xNode.SelectSingleNode('//add[@key='' + AppKey + '']');if ( xElem1 !=null ){AppValue=xElem1.GetAttribute ('value');}else{//MessageBox.Show ('There is not any information!');}

}

#endregion

本文来自网络,不代表本站立场,转载请注明出处:https: