commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration] Combined Configuration examples
Date Sun, 13 Nov 2016 17:05:33 GMT
Hi Greg,

Am 13.11.2016 um 15:07 schrieb Greg Torrance:
> Hi all,
> 
> I am trying to work out the precise differences between
> OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
> examples on this page
> (https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html)
> are confusing to me.
> 
> testfile1.xml and testfile2.xml both contain Channels with id="4",
> however none of the Combiner Results shows any Channels with id="4". 
> And the Notes on the right-hand side of the page contain no mention of
> Channel 4.
> 
> Am I missing something? Are the examples correct?
Hm, it looks as if the examples are partly incorrect. I assume that the
channel with id="4" should not be part of testfile1.xml, but only be
contained in the second file. It should appear in the results of union
and merge combiner. Does that make sense?

> 
> What I'm really trying to understand is the impact of attributes in the
> way the various combiners choose to combine elements. (Any pointers to
> further documentation on this would be appreciated.)
Some more information can be found in the Javadocs of the combiner classes:
- UnionCombiner states: "Another limitation is the handling of
attributes: Attributes can only have a single value. So if two nodes are
to be combined which both have an attribute with the same name, it is
not possible to construct a proper union attribute. In this case, the
attribute value from the first node is used."

- OverrideCombiner has an addAttributes() method with the following
documentation: "Handles the attributes during a combination process.
First all attributes of the first node are added to the result. Then all
attributes of the second node, which are not contained in the first
node, are also added."

- The merging behavior of MergeCombiner is also described in its class
documentation.

Does this help?
Oliver

> 
> Thoughts?
> 
> Thanks,
> Greg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message