Hi Oliver,

Thanks for the reply. That is helpful!

> 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?

I'm not clear why -- if the channel with id="4" is not contained in testfile1.xml -- why it will not end up in the results from all three combiners. Why just union and merge and not override, too?

As for the attributes, do I understand correctly that the attribute values for elements are used, essentially, as "key" values to distinguish the various elements for combining purposes? And if the values of any attributes of two elements differ, then the elements would be considered different elements for combining purposes? (Said another way, if two elements have a set of attributes in common, if the values for those common attributes are the same, the elements will be considered to match.) Does that make sense? Is that correct?

Thanks again for the reply.

Greg

On 11/13/2016 12:05 PM, Oliver Heger wrote:
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-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

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




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

Reply via email to