First, Configure permissions, add access permissions, and the suffix.
And then generate nodes using LINQ to XML.
Finally, use the metro file operation to generate a file and write something into it.
// Create XML xdocument tree = new xdocument (); tree. declaration = new xdeclaration ("1.0", "UTF-8", "no"); tree. add (New xelement ("Tree"); xelement node = new xelement ("Node"); // Add node. setattributevalue ("name", "miaomiao"); // Add the node attribute to the node. setattributevalue ("ID", "111"); tree. element ("Tree "). add (node); // Add the node to the tree storagefile file = await knownfolders. documentslibrary. createfileasync ("mm. XML "); irandomaccessstream S = await file. openasync (fileaccessmode. readwrite); datawriter d = new datawriter (S. getoutputstreamat (0); D. writestring (tree. tostring (); await D. storeasync (); await D. flushasync ();
Effect: