code: private XMLEventWriter createXmlEventWriter(StringWriter stringWriter)
              throws FactoryConfigurationError, XMLStreamException {
          return new IndentingXMLEventWriter(XMLOutputFactory.newInstance()
                  .createXMLEventWriter(stringWriter));
      }
docs: Wrap an XMLEventWriter around that StringWriter.