[ https://issues.apache.org/jira/browse/CONFIGURATION-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bourg reopened CONFIGURATION-168: ------------------------------------------ > [configuration] Messed file on saving an XMLConfiguration > --------------------------------------------------------- > > Key: CONFIGURATION-168 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-168 > Project: Commons Configuration > Issue Type: Improvement > Affects Versions: Nightly Builds > Environment: Operating System: other > Platform: Other > Reporter: Ben Hutchison > Priority: Minor > > The XMLConfiguration is a configuration based on XML. But when the > configuration is used to save config properties back into the XML file from > code, its makes a total mess of the file and doesnt follow basic XML > conventions. > If a particular key group already exists, rather than insert new keys there, > it always just appends new properties to the end of the file. After repeated > modification, the file becomes an unstructured, unreadable mess. What should > happen is illustrated below. Starting file: > <configuration> > <a> > <key1>value1</key1> > </a> > </configuration> > Configuration.addProperty("a.key2", "value2") should result in: > <configuration> > <a> > <key1>value1</key1> > <key2>value2</key2> > </a> > </configuration> > Because of the way setProperty() works, (remove then add), this behaviour > also > results in the same property being moved, it if is modified. So in the > example > above, modifying <key1> would cause it to be moved to the end of file, > leaving > an empty <a> group at the start. Its just unworkable! > Also, a seperate but releated issue is that a "pretty-print" output format > would greatly improve developer and user ease-of-use. Currently, there is no > indenting, so files that are modified by the XMLConfiguration become very > hard > to read/maintain. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]