XmlDocument XmlDoc;

XmlNode NewAttribute;

XmlNode RootNode;



XmlDoc = new XmlDocument();

XmlDoc.Load("E:\\XmlDir\\XmlDoc.xml");



RootNode = XmlDoc.SelectSingleNode("TheRoot");



XmlNode NewNode = XmlDoc.CreateElement("Person");

RootNode.AppendChild(NewNode);



NewAttribute = XmlDoc.CreateAttribute("Name");

NewAttribute.Value = "whatever";

NewNode.Attributes.SetNamedItem(NewAttribute);

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2023-01-29
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2022-03-01
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案