Page 1 of 1

Format xml output

PostPosted: Thu Jun 04, 2009 11:35 am
by boz0413
Hi,

Is there a class/method available to format a given open xml string into a more readable format?

For example, given the code:

Code: Select all
String xml = XmlUtils.marshaltoString( wmlDocumentEl, true );


is there a method that will take the xml string returned here and format it so that it is not all on a single line?

Thanks in advance,
James

Re: Format xml output

PostPosted: Thu Jun 04, 2009 1:34 pm
by jason
Yes, there are other signatures, for example:

Code: Select all
marshaltoString(java.lang.Object o, boolean suppressDeclaration, boolean prettyprint)


you want prettyprint true.

See the Javadoc at http://dev.plutext.org/docx4j/doc/org/d ... %20boolean)

Re: Format xml output

PostPosted: Thu Jun 04, 2009 2:15 pm
by boz0413
Thanks Jason.

Really enjoying using the library btw.

Re: Format xml output

PostPosted: Sat Jun 06, 2009 12:43 pm
by jason
boz0413 wrote:Really enjoying using the library btw.


:-)