title: Writing a XML file with C# to a specific XML structure
body: <p>The Usual way, i code to write a XML file is,</p>
  
  <pre><code>    XmlWriterSettings settings = new XmlWriterSettings();
      settings.Indent = true;
      XmlWriter writer = XmlWriter.Create("Products.xml", settings);
  
      writer.WriteStartDocument();
  
      writer.WriteComment("This file is generated by the program.");
  
      writer.WriteStartElement("Product");
      writer.WriteAttributeString("ID", "001");
      writer.WriteAttributeString("Name", "Keyboard");
      writer.WriteElementString("Price", "10.00");
      writer.WriteStartElement("OtherDetails");
      writer.WriteElementString("BrandName", "X Keyboard");
      writer.WriteElementString("Manufacturer", "X Company");
      writer.WriteEndElement();
      writer.WriteEndDocument();
      writer.Flush();
      writer.Close();
  </code></pre>
  
  <p>But the above code gives me a different XML structure, How to code if i need the output as below given structure,</p>
  
  <pre><code>&lt;Books&gt;
  &lt;Book ISBN="0553212419"&gt;
  &lt;title&gt;Sherlock Holmes&lt;/title&gt;
  &lt;author&gt;Sir Arthur Conan Doyle&lt;/author&gt;
  &lt;/Book&gt;
  &lt;Book ISBN="0743273567"&gt;
  &lt;title&gt;The Great Gatsby&lt;/title&gt;
  &lt;author&gt;F. Scott Fitzgerald&lt;/author&gt;
  &lt;/Book&gt;
  &lt;Book ISBN="0684826976"&gt;
  &lt;title&gt;Undaunted Courage&lt;/title&gt;
  &lt;author&gt;Stephen E. Ambrose&lt;/author&gt;
  &lt;/Book&gt;
  &lt;Book ISBN="0743203178"&gt;
  &lt;title&gt;Nothing Like It In the World&lt;/title&gt;
  &lt;author&gt;Stephen E. Ambrose&lt;/author&gt;
  &lt;/Book&gt;
  &lt;/Books&gt;
  </code></pre>
  
  <p>Thanks</p>