.NET C # Operate XML

zhaozj2021-02-16  79

String Xpath = "// Topic";

String path = "d: //roy/notebook.xml";

XMLDocument Xmldoc = new xmldocument ();

XMLDoc.Load (path);

XMLNode root = xmldoc.selectsinglenode (xpath);

XmLelement Tz = Xmldoc.createElement ("subtopic");

Tz.SetaTRibute ("Subject", "Test");

Root.Appendchild (TZ);

XMLDoc.save (path);

转载请注明原文地址:https://www.9cbs.com/read-14998.html

New Post(0)