below is xml file which I want to update (for example - change dateTime attribute in log element).
<?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> Here is my code:
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); But, the problem is: node1 is alwas null. I now the problem cause this line in xml file:
raml xmlns="raml21.xsd" version="2.1" but, i can't find solution.
Thanks in advance..
No comments:
Post a Comment