title: Customizing XmlSerialize output
body: <p>I'm creating an xml file with the xmlserialize class, the output that I get is nearly what I need.
  This is what I get</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;pdf file-name="C:\Users\d.sassoli\Desktop\media\mergiato.pdf" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
   &lt;document&gt;
    &lt;document start-page="1"&gt;
     &lt;SheetChange&gt;
       &lt;SheetChange sheet-type="A4" page-number="1"/&gt;
       &lt;SheetChange sheet-type="A3" page-number="2"/&gt;
      &lt;/SheetChange&gt;
   &lt;/document&gt;
  &lt;/pdf&gt;
  </code></pre>
  
  <p>This is what I want</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
   &lt;pdf file-name="C:\Users\d.sassoli\Desktop\media\mergiato.pdf" &gt;
    &lt;document start-page="1"&gt;
       &lt;SheetChange sheet-type="A4" page-number="1"/&gt;
       &lt;SheetChange sheet-type="A3" page-number="2"/&gt;
  &lt;/pdf&gt;
  </code></pre>
  
  <p></p>
  
  <p>And these are my classes where I define the structure of my xml</p>
  
  <pre><code>   [XmlRootAttribute("pdf", IsNullable = false)]
  public class Pdf
  {
      private Pdf() { }
      public static Pdf Builder()
      {
          Pdf pdf = new Pdf();
          return pdf;
      }
      [XmlAttribute("file-name")]
      public List&lt;string&gt; FileName { get; set; }
      public List&lt;document&gt; document;
  
  }
  public class document 
  {
  
      private document() { }
      public static document Builder()
      {
          document doc = new document();
          return doc;
      }
      [XmlAttribute("last-page")] public string LastPage;
      [XmlAttribute("start-page")] public string StartPage;
      public List&lt;SheetChange&gt; SheetChange;
  
  }
  public class SheetChange
  {
      private SheetChange() { }
      public static SheetChange Builder()
      {
          SheetChange sheetChange = new SheetChange();
          return sheetChange;
      }
      [XmlAttribute("page-number")]
      public string PageNumber { get; set; }
      [XmlAttribute("sheet-type")]
      public string SheetType { get; set; }
  }
  </code></pre>
  
  <p>I tried fiddling around with the xmlattribute but didn't achieve what I wanted.</p>