title: writing to xml attributes
body: <p>Hey all i have code to write to an xml doc from asp</p>
  
  <pre><code>        string filePath = Server.MapPath("../XML/MyXmlDoc.xml");
          XmlDocument xmlDoc = new XmlDocument();
  
          try
          {
              xmlDoc.Load(filePath);
          }
          catch (System.IO.FileNotFoundException)
          {
              //if file is not found, create a new xml file
              XmlTextWriter xmlWriter = new XmlTextWriter(filePath, System.Text.Encoding.UTF8);
              xmlWriter.Formatting = Formatting.Indented;
              xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
              string startElement = "markings";
              xmlWriter.WriteStartElement(startElement);
              xmlWriter.Close();
              xmlDoc.Load(filePath);
          }
          XmlNode root = xmlDoc.DocumentElement;
          XmlElement mainNode = xmlDoc.CreateElement("mark");
          XmlElement childNode1 = xmlDoc.CreateElement("studentFirstName");
          XmlElement childNode2 = xmlDoc.CreateElement("studentLastName");
          XmlElement childNode3 = xmlDoc.CreateElement("className");
          XmlElement childNode4 = xmlDoc.CreateElement("marks");
  
          XmlText childTextNode1 = xmlDoc.CreateTextNode("");
          XmlText childTextNode2 = xmlDoc.CreateTextNode("");
          XmlText childTextNode3 = xmlDoc.CreateTextNode("");
          XmlText childTextNode4 = xmlDoc.CreateTextNode("");
  
          root.AppendChild(mainNode);
  
          //this portion can be added to a foreach loop if you need to add multiple records
  
          childTextNode1.Value = "John";
          childTextNode2.Value = "Doe";
          childTextNode3.Value = "Biology";
          childTextNode4.Value = "99%";
  
          mainNode.AppendChild(childNode1);
          childNode1.AppendChild(childTextNode1);
          mainNode.AppendChild(childNode2);
          childNode2.AppendChild(childTextNode2);
          mainNode.AppendChild(childNode3);
          childNode3.AppendChild(childTextNode3);
          mainNode.AppendChild(childNode4);
          childNode4.AppendChild(childTextNode4);
  
          //end of loop section
  
          xmlDoc.Save(filePath);
  </code></pre>
  
  <p>which works fine but i want to store the xml in the following structure</p>
  
  <pre><code>graph
  
     set name="John Doe" value="99";
  
  /graph
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>name John Doe /name
  value 99 /value
  </code></pre>
  
  <p>is there a way to store the xml like this? thanks all</p>