Copy the following code to the button event to compile execution, generate the POS.xml file XMLTextWriter XTW = New XmlTextWriter XTW = New XmlTextWriter (Request.PhysicalApplicationPath "POS.XML", System.Text.Encoding.utf8); XTW. Formatting = formatting.indented; xtw.writestartDocument (false); // Result:
Xtw.WriteComment ("POS Infomation"); // Document Note Result:
Xtw.writeStartElement ("info"); // XML root node results:
XTW.WriteStartElement ("ZC", NULL);
// XML element 1 Result:
Xtw.writeElementstring ("KMDM", "0301");
// XML element 1 key value:
0301
Xtw.writeElementstring ("scbj", "1");
// XML element 1 key value:
1
Xtw.writeElementstring ("ZY", "100");
// XML element 1 key value:
100
Xtw.writeEndelement ();
// XML element 1 ends the result:
Xtw.flush ();
Xtw.WriteStartElement ("Posinfo", NULL;
// XML element 2 results:
XTW.WRITEATTRIBUTESTRING ("KPID", "030100111");
Xtw.writeAttributeString ("POSX", "289");
XTW.WRITEATTRIBUTESTRING ("Posy", "47");
// XML element 2 attribute results:
Xtw.writeEndelement ();
// XML element 2 ends the result:
Xtw.writeEndelement ();
// XML root end Result:
Xtw.flush (); xtw.close (); // Release Resource Note: The result is running result