title: How to indent XML properly using XMLSerializer?
body: <p>I'm having a hard time trying to indent XML files using <code>XMLSerializer</code>.</p>
  
  <p>I've tried</p>
  
  <pre><code>serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output",
                        true);
  </code></pre>
  
  <p>I've tried to append <code>\n</code> into <code>FileWriter</code> but the output is the <code>\n</code>'s and <code>\t</code>'s at the beginning of the file and not in the right place. I've tried <code>setPropery</code> with the proper URI etc.</p>
  
  <p>Part of the code:</p>
  
  <pre><code>XmlPullParserFactory parserFactory = XmlPullParserFactory.newInstance();
  parserFactory .setNamespaceAware(true);
  XmlSerializer serializer = parserFactory .newSerializer();
  File xmlFile = new File(PATH + ".xml");         
  FileWriter writer = new FileWriter(xmlFile);            
  serializer.setOutput(writer);
  //serializer.setProperty(INDENT_URL, INDENT);
  serializer.startDocument("UTF-8", null);
  //serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output",
                          true);
  serializer.startTag(null, "bla");
  writer.append('\n');
  </code></pre>
  
  <p>What am I missing?</p>