atteo / xml-combiner

Combines several XML documents into one
Apache License 2.0
58 stars 12 forks source link

Pluggable element matching strategies #1

Open pimlottc opened 9 years ago

pimlottc commented 9 years ago

Nice little well-focused library! I'm looking at this for a XML split/merge use case in a project. I wonder what you'd think of the idea of extracting the current code for matching elements into a strategy object which could then be swapped out to allow other matching algorithms. For example, in my project I want to match elements only if all attributes and their values match, which I can't do in the current code unless I exhaustively list every single possible attribute name as a key.

sentinelt commented 9 years ago

I am thinking about introducing such a strategy for some time already. I am using the library to merge standalone.xml configuration files for JBoss and it also turned out that listing all possible key names is not enough.

I will probably add such a feature in a 2-3 weeks timeframe. In the meantime pull requests are welcomed.

pimlottc commented 9 years ago

I submitted a pull request that pulls the strategy out into a ChildContextsMapper subclass. It's basis of what I've been using in a work project, see what you think.

https://github.com/atteo/xml-combiner/pull/2