code: public static XMLStreamWriter getIndentingXmlStreamWriter(Writer writer) throws XMLStreamException, IOException {
          XMLOutputFactory f = XMLOutputFactory.newInstance();
          return new IndentingXMLStreamWriter(f.createXMLStreamWriter(writer));
      }
docs: Return an XMLStreamWriter which indents the xml
  (ideally XMLOutputFactory would support a property which would set this up for us to avoid a dependency
  on a com.sun.xml class, but it doesn't for the present time appear to do so)