Effect: Read and modify from 1.xml, then write 2.xml, two XML documents are as follows 1.xml --------------------- --------------- XML Version = "1.0" Encoding = "GB2312"?>
text); sub.settext ("new item" string.valueof (i)); // change the content of the child node} element item = (element) list.get (0); // get the first root node A child node attribute a = new attribute ("start", "true"); // Add a new attribute item.addattribute (a); item.setttribute ("name", "new item"); // change the old Attribute value string indent = ""; // Inditive symbol Boolean newlines = false; // Does the new line XMLOUTPUTTER OUTP = New XMLOUTPUTTER (IND, NewLines, "GB2312"); // Construct new output stream Outp.output (DOC, New FileOutputStream ("2.xml")); // Output to 2.xml file}}