I need to configure an application in different ways.The configuration is in XML.Different configurations will mostly have common parts. For example the difference between two configurations will be a difference of an email address.
So rather than duplicating the common parts I was thinking is there a way to have a base XML file and override/add to only parts of it and generate a resultant XML file.
I've seen this functionality in Maven - you have a parent pom and the child pom inherits from it. What is used in the end is the effective pom.
1) Are there already libraries ( for any programming language but preferably for Java ) that does this?
2) If not what would be a good approach to implement this?I'm not very familiar with XML technologies such as XSD and XSLT. So the obvious way might not be as obvious to me.
Any help is much appreciated.
I would probably use XInclude. There seems to be some support in Java, so I would search for "xinclude for java" with a qualifier for your specific stack.
xerces copes well with it; the default if off, so you have to turn the feature http://apache.org/xml/features/xinclude on.
For a general read on XInclude, this article shows the concept at work.