0
以下は、更新したいXMLファイルです(例えば、log要素のdateTime属性の変更)。問題がある、asp.netのraml21.xsdスキーマに基づくxmlファイルの要素の値を変更
filePath = openFileDialogXml.FileName;
XmlDocument document = new XmlDocument();
document.Load(filePath);
XmlElement node1 = document.SelectSingleNode("/header/log") as XmlElement;
if (node1 != null)
{
node1.Attributes[3].Value = "test";
}
document.Save(filePath);
:しかし
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<raml xmlns="raml21.xsd" version="2.1">
<cmData id="3221225472" scope="all" type="plan">
<header>
<log action="created" appInfo="Nokia BTS Site Manager" appVersion="FL16" dateTime="2016-09-23T17:59:59" user="BTSSM"/>
</header>
</cmData>
</raml>
は、ここに私のコードですnode1は常にnullです。私は今問題がXMLファイルのこの行の原因:
raml xmlns="raml21.xsd" version="2.1"
。どうもありがとう。 – Zoc