Subject: | Feature proposal: merge on multiple unique ids |
First, thank you for a highly useful module. It has worked simply and
effectively for my particular problem.
As my data sets evolved, though, I ran into one issue with XML::Merge. I
have some data that looks like this:
<root> <!-- set one -->
<table name="a">
<group id1="1" id2="a">
<data1>...</data1>
</group>
</table>
</root>
<root> <!-- set two -->
<table name="a">
<group id1="1" id2="b">
<data2>...</data2>
</group>
</table>
</root>
Here, I'm using multiple attributes on the group element as unique
identifiers. I use "set_id_xpath_list()" to add id1 and id2 here (I also
tried @*). When I merge these together with cres=main, I get:
<root>
<table name="a">
<group id1="1" id2="a">
<data1>...</data1>
<data2>...</data2>
</group>
</table>
</root>
What I want to get is:
<root>
<table name="a">
<group id1="1" id2="a">
<data1>...</data1>
</group>
<group id1="1" id2="b">
<data2>...</data2>
</group>
</table>
</root>
I fear that I'm not familiar enough with the intentions of XML::Merge to
know whether or not this is truly a bug, or intended operation. It seems
to me, though, that support for multiple unique IDs per element can be
considered an extra feature.
In any case, I needed it and wanted to stick with XML::Merge, so I added
support myself. I've attached my updated version of Merge.pm. It has an
different Version (so I could tell it was my modded copy), and my fix. I
tested this on a few data sets, though not exhaustively, and I believe
it adds a feature without breaking others.
I hope that you find this useful, and consider releasing a new version.
Feel free to use this update directly, or modify it as you see fit.
Thanks again for a great module,
-Kevin D'Aquila
Subject: | Merge.pm |
Message body is not shown because it is too large.