android - XML endTag Line Break -


i trying create xml document android, , i'm facing problems. here of code:

xmlserializer xml = xml.newserializer(); stringwriter writer = new stringwriter(); xml.setoutput(writer); xml.startdocument("utf-8", true); xml.starttag("" , "edbauditoria"); xml.starttag("", "afseq");  xml.text(this.getafseq()); xml.endtag("", "afseq"); xml.starttag("", "data");   xml.text(this.getdata());  xml.endtag("", "data");    

this works fine , generates file, when checking file .. there no line breaks between tags .. here follows lines of generated file:

no line breaks between tags

<?xml version='1.0' encoding='utf-8' standalone='yes' ?><edbauditoria><afseq>lipo20130709204106r43540</afseq><data>09/07/2013</data> 

it should created ...

<?xml version='1.0' encoding='utf-8' standalone='yes' ?> <edbauditoria> <afseq>98184estagiario22013020502:4423307</afseq> <data>05/02/2013</data> <hora>02:44 pm</hora> <auditor>estagiario2</auditor> <shopping>027</shopping> <loja>108</loja> <qtd>2</qtd> 

line breaks , other whitespace aren't insignificant in random xml vocabulary. if want automatic indentation, have explicitly tell serializer add it.

xml.setoutputformat(new outputformat("xml", "utf-8", true));


Comments