Hello Raimund,
Am 21.12.2011 14:14, schrieb Klein, Raimund:
Hello again Oliver,
Thanks for the quick answer - and sorry for the long time until this one...
Anyway, as for the SubnodeConfigurations, you may already have noticed this is
now registered as Jira issue CONFIGURATION-472.
Thanks.
As for the formatting, I looked at the code and noticed that XMLConfiguration's
createTransformer() method already sets a few output properties. Unfortunately,
there seems to be no standard property key for the indentation number which is
necessary according to
http://stackoverflow.com/questions/1264849/pretty-printing-output-from-javax-xml-transform-transformer-with-only-standard-j
. Since the solutions presented there rely on the underlying XML
implementation, maybe XMLConfiguration should keep its own (additional) map of
output properties that can be specified by the user (plus maybe a static map of
default output properties)? After all, the user should know the used XML
implementation.
Or we could make it easier to inject a custom transformer. Maybe by
providing something like a TransformerFactory?
Oliver
Mit freundlichen Grüßen / Kind regards
Raimund Klein
EDV / Software Entwickler
BERENBERG BANK
Joh. Berenberg, Gossler& Co. KG
Neuer Jungfernstieg 20
20354 Hamburg
Telefon +49 40 350 60-8129
Telefax +49 40 350 60-955
E-Mail [email protected]
www.berenberg.de
Sitz: Hamburg - Amtsgericht Hamburg HRA 42659
-----Ursprüngliche Nachricht-----
Von: Oliver Heger [mailto:[email protected]]
Gesendet: Dienstag, 13. Dezember 2011 17:45
An: Commons Users List
Betreff: Re: [configuration] Issues with XMLConfiguration
Hello Raimund,
many thanks for your feedback.
Am 13.12.2011 14:45, schrieb Klein, Raimund:
Hi everyone,
I've been playing around with configuration 1.7 for a while now,
specifically XMLConfiguration (since I'm a fan of hierarchical files)
and the XPathExpressionEngine. Cool stuff. :-)
However, I've run into two issues:
- Since my file is nested a couple of levels, I like to create
configuration nodes with children myself and then add whole subtrees
at the appropriate points. For the self-created nodes, I rely on
org.apache.commons.configuration.tree.DefaultConfigurationNode. I also
like the SubnodeConfiguration class while working on the subtree.
However, I've found that when really adding new nodes to the
configuration, I can't simply add them to a matching
SubnodeConfiguration, as they won't be converted into XML Nodes, which
causes possible ClassCastExceptions later on. Instead, I have to add
them to the XMLConfiguration directly. This is due to the fact that
XMLConfiguration overrides addNodes(String, Collection) and converts
the nodes in the Collection into its own XML nodes; however,
SubnodeConfiguration of course doesn't do this. I've been wondering
whether this is intentional or maybe I'm completely missing the idea
of the class SubnodeConfiguration itself. Maybe XMLConfiguration
's configuration(s)At methods should return a subclass of SubnodeConfiguration
which will perform the same node conversion?
This is not by intension, it is rather a missing feature (well, maybe even a
bug). Could you please open a ticket in our bug tracking system [1] for this?
It's a good idea to let XMLConfiguration return a specific
SubnodeConfiguraition with an overridden createNode() method.
- Is there a way to assign a formatter to changed XMLConfigurations when
saving? I've found inspecting and maybe even changing the stored configuration
files by hand a bit cumbersome, as there is apparently no such thing as
auto-indent. As I'm expecting my files to grow over time, this would come in
quite handy.
Unfortunately, there is no support for formatting yet. This would certainly be
a nice new feature. However, I am not sure what would be a suitable interface
for such a formatter?
Thanks
Oliver
[1] http://commons.apache.org/configuration/issue-tracking.html
Other than that, I'm quite happy with what I've found so far. :-)
Mit freundlichen Grüßen / Kind regards
Raimund Klein
EDV / Software Entwickler
BERENBERG BANK
Joh. Berenberg, Gossler& Co. KG
Neuer Jungfernstieg 20
20354 Hamburg
Telefon +49 40 350 60-8129
Telefax +49 40 350 60-955
E-Mail [email protected]
www.berenberg.de<outbind://75/www.berenberg.de>
Sitz: Hamburg - Amtsgericht Hamburg HRA 42659
Diese Nachricht einschliesslich etwa beigefuegter Anhaenge ist
vertraulich und kann dem Bank- und Datengeheimnis unterliegen oder
sonst rechtlich geschuetzte Daten und Informationen enthalten. Wenn
Sie nicht der richtige Adressat sind oder diese Nachricht irrtuemlich
erhalten haben, informieren Sie bitte sofort den Absender über die
Antwortfunktion. Anschliessend moechten Sie bitte diese Nachricht
einschliesslich etwa beigefuegter Anhaenge unverzueglich vollstaendig
loeschen. Das unerlaubte Kopieren oder Speichern dieser Nachricht
und/oder der ihr etwa beigefuegten Anhaenge sowie die unbefugte
Weitergabe der darin enthaltenen Daten und Informationen sind nicht
gestattet. Wir weisen darauf hin, dass rechtsverbindliche Erklaerungen
namens unseres Hauses grundsaetzlich der Unterschriften zweier
ausreichend bevollmaechtigter Vertreter unseres Hauses beduerfen. Wir
verschicken daher keine rechtsverbindlichen Erklaerungen per E-Mail an
Dritte. Demgemaess nehmen wir per E-Mail au
ch keine rechtsverbindlichen Erklaerungen oder Auftraege von Dritten entgegen.
Sollten Sie Schwierigkeiten beim Oeffnen dieser E-Mail haben, wenden Sie sich
bitte an den Absender oder an [email protected]. Please refer to
http://www.berenberg.de/my_berenberg/disclaimer_e.html for our confidentiality
notice.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Diese Nachricht einschliesslich etwa beigefuegter Anhaenge ist vertraulich und
kann dem Bank- und Datengeheimnis unterliegen oder sonst rechtlich geschuetzte
Daten und Informationen enthalten. Wenn Sie nicht der richtige Adressat sind
oder diese Nachricht irrtuemlich erhalten haben, informieren Sie bitte sofort
den Absender über die Antwortfunktion. Anschliessend moechten Sie bitte diese
Nachricht einschliesslich etwa beigefuegter Anhaenge unverzueglich vollstaendig
loeschen. Das unerlaubte Kopieren oder Speichern dieser Nachricht und/oder der
ihr etwa beigefuegten Anhaenge sowie die unbefugte Weitergabe der darin
enthaltenen Daten und Informationen sind nicht gestattet. Wir weisen darauf
hin, dass rechtsverbindliche Erklaerungen namens unseres Hauses grundsaetzlich
der Unterschriften zweier ausreichend bevollmaechtigter Vertreter unseres
Hauses beduerfen. Wir verschicken daher keine rechtsverbindlichen Erklaerungen
per E-Mail an Dritte. Demgemaess nehmen wir per E-Mail au
ch keine rechtsverbindlichen Erklaerungen oder Auftraege von Dritten entgegen.
Sollten Sie Schwierigkeiten beim Oeffnen dieser E-Mail haben, wenden Sie sich
bitte an den Absender oder an [email protected]. Please refer to
http://www.berenberg.de/my_berenberg/disclaimer_e.html for our confidentiality
notice.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]