Try XmlOptions.setPrettyPrint() There are some other methods in XmlOptions that can help you tailor the spacing etc. -jacobd
On Wed, Mar 11, 2009 at 4:14 PM, Garima Bathla <garima.bat...@gmail.com>wrote: > So I am using xmlbeans to generate xml instance based on xsd schema. But > the issue is that in my generated xml instance all the tokens in xml are > well formed but missing \n ( new line); How do I generate an xml instance > with new line characters already inserted so that the generated xml is more > readable. > > so my current output is like this > > <start><home><address><unit>2200</unit><street>XYZ</street><state>WA</state><country>USA</country><zip>98122</zip></address></home></start> > > And I want the output to look like: > > <start> > <home> > <address> > <unit>2200</unit> > <street>XYZ</street> > <state>WA</state> > <country>USA</country> > <zip>98122</zip> > </address> > </home> > </start> > > So that it is more readable? ANY help in this direction will be helpful. > > Regards, > Garima. >