I am using StAX XML stream writer to write the XML file. It writes all the data in a single line. I want all the tags to be indented instead of a single line.
See Question&Answers more detail:osI am using StAX XML stream writer to write the XML file. It writes all the data in a single line. I want all the tags to be indented instead of a single line.
See Question&Answers more detail:osstax-utils provides class IndentingXMLStreamWriter
which does the job:
XMLStreamWriter writer =
XMLOutputFactory.newInstance().createXMLStreamWriter(...);
writer = new IndentingXMLStreamWriter(writer);
...