commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Migowski" <chrismf...@gmail.com>
Subject Re: Commons Configuration - XML Layout
Date Wed, 19 Nov 2008 14:17:06 GMT
Hi Brian,

i asked the same some time ago and got the answer that pretty print isn't
supported by commons-configuration. Here is how I do it (quick&easy, you
need jdom):

org.jdom.Document confDoc = *new* org.jdom.input.DOMBuilder().build(*
masterconfig*.getDocument());
*if* (confDoc != *null*) {
OutputStream output = *new* FileOutputStream(*masterconfig*.getFile());
XMLOutputter outputter = *new* XMLOutputter();
outputter.output(confDoc, output);
} *else* {
*masterconfig*.save();
}

masterconfig is the XMLConfiguration object.
hth,
best regards,
christian!



2008/11/19, Brian Boyle <bboyle18@gmail.com>:
>
> Hi there,
>
> I'm using commons configuration for managing my xml configuration. This
> also
> involves me writing new properties to my xml file.
> When I do config.addProperty() then save it, the new property that has been
> added to my xml file does not indent correctly so as to make the xml more
> readable.
> Is there a way that I can control this with commons configuration or is
> there a workaround that I can use?
>
> Thanks in advance,
>
> Brian
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message