commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pär Dahlberg <>
Subject Re: Format XML output for Configuration
Date Thu, 01 Oct 2009 18:24:15 GMT
A lot of people will probably not need formatting, so having an option to
use it for those of us who need it would be nice.

For example being able to supply ones own XSLT document to control the
output or perhaps have the option to add for example dom4j if one didn't
mind the extra library.

/M v h Pär
Welcome to my blog, mostly about programming:

On Fri, Sep 25, 2009 at 21:28, Oliver Heger <>wrote:

> Pär Dahlberg schrieb:
>> Hi
>> I got a Commons Configuration question. Is there some easy way to format
>> the
>> XML output from an XMLConfiguration?
>> Reading a config file and saving it works very well. However each time the
>> file is saved a couple of empty lines are inserted between random
>> elements.
>> The file is of course still usable, but it looks quite bad when editing by
>> hand after beeing saved a few times.
> XMLConfiguration stores the DOM tree obtained from the parser. When saving,
> the tree is written using an XSLT identity transformation. This should
> normally not mess up the formatting.
> However, if properties are modified or added, the nodes created by these
> operations typically do not match the format of the other nodes which causes
> poor results when writing the configuration back to disk. Also creating a
> new XML configuration produces unformatted documents.
> Does anybody have an idea how a better formatting could be implemented? In
> the early days we used a library like dom4j for XML handling. This produced
> nice-looking documents, but the price was an additional dependency. I don't
> think we should go back.
> Oliver
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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