XML special

xiaoxiao2021-03-06  96

Using system.xml; using system.io;

Summary description of Namespace XML {///

/// Class1. /// class class1 {/// /// The primary entry point of the application. /// [static "static void main (string [] args) {// // Todo: Add code here to launch the application // xmldocument xmldoc = new xmldocument ();

XmLelement Element = XMLDoc.createElement ("root");

XMLELEMENT E2 = XMLDoc.createElement ("Item"); E2.SetAttribute ("ID", "1"); E2.SetaTRibute ("Name", "First"); E2.SetaTRibute ("Descript", "Descript1") E2.SetaTRibute ("ParentID", "0");

XMLELEMENT E3 = XMLDoc.createElement ("Item"); E3.SetaTRibute ("ID", "2"); E3.SetAttribute ("Name", "SECOND"); E3.SetaTRibute ("Descript", "Descript2") E3.SetaTribute ("ParentID", E2.GetaTRibute ("ID")); E2.Appendchild (E3); ELEMENT.APPENDCHILD (E2);

XmLDoc.Appendchild (Element); XmlTextWriter Writer = New XmlTextWriter ("category.xml", system.text.encoding.default); xmldoc.save (Writer);

}}}

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

New Post(0)