VaR seg = username; If (file. exists (username + ". xml") // C {string name = "notremindbox ";
Xmldocument xdocs = new xmldocument (); xdocs. load (username + ". XML "); // load the XML file // search for the element xmlnode car = xdocs by ID. selectsinglenode ("// notremindbox [@ name = \" "+ name +" \ "]"); // xmlnode node = xdocs. selectsinglenode ("Aasman/makeannc/field [@ name = 'zone _ maps ']"); xmlelement Xe = (xmlelement) car; // Xe. setattribute ("value", "sdfdf"); // modify the Xe value. innertext = "true"; xdocs. save (username + ". XML ");} else {// instantiate an XML document xmldocument xdoc = new xmldocument (); // instantiate an XML document declaration xmldeclaration xdela = xdoc. createxmldeclaration ("1.0", "UTF-8", "yes"); // Add the declaration to the document xdoc. appendchild (xdela); // create the element user xmlelement user = xdoc. createelement ("user"); // append the user element node to xdoc in the document. appendchild (User );
// No longer prompt notremindboxs xmlelement notremindboxs = xdoc. createelement ("notremindbox"); // The notremindboxs node specifies the text content handler. innertext = "true"; user. appendchild (notremindboxs );
// Add the xmlattribute name = xdoc. createattribute ("name"); Name. value = "donotprompt"; notremindboxs. attributes. append (name); // Add comments // xmlcomment XC = xdoc. createcomment ("this movie is funny"); // movie2.appendchild (XC );
// Save xdoc. Save (username + ". xml");} // string EE = "0013 ";
// Xmldocument xdocs = new xmldocument (); // xdocs. Load ("movies2.xml"); // load the XML file
//// Search for elements by ID // xmlnode car = xdocs. selectsinglenode ("// moviez [@ No = \" "+ EE +" \ "]"); // xmlnode node = xdocs. selectsinglenode ("Aasman/makeannc/field [@ name = 'zone _ maps ']"); // xmlelement Xe = (xmlelement) car; // Xe. setattribute ("value", "sdfdf"); // Xe. innertext = "dfgdfg"; // car ["moviez"]. value = EE + "1"; // xdocs. save ("movies2.xml ");
}
Determine whether the XML file is in an inch