Loading login details...

DeltaXML Support Forums

 new topic  post reply 
moderators: chrisc nigelw tristanm
Excluding differences
Joined: 02-October-2007
Posts: 3
Location: Malvern, United Kingdom
Posted: 03-October-2007 16:43
The following question was emailed to DeltaXML and has been diverted/answered in this forum:

I have some specific questions about your product,
I list below to tell you want I am trying to do.

For example, we have 1 config.xml file, that is across many systems and is different in most cases.  I want to be about in a linux command line environment to compare each of these against a "gold copy" and have it tell me the differences. 

Also be able to exclude the differences that I don't care or want to know about for example "servername" or "location".

Thanks!   
Command-line example and techniques to ignore differences
Joined: 27-March-2007
Posts: 54
Location: Malvern, United Kingdom
Posted: 03-October-2007 17:06
For example, we have 1 config.xml file, that is across many systems and is different in most cases.  I want to be about in a linux command line environment to compare each of these against a "gold copy" and have it tell me the differences.


Command line use is described in one of the README files included in the release.   A simple example would be:

$ java -jar /path/to/deltaxml/command.jar compare delta file1.xml file2.xml result.xml


Also be able to exclude the differences that I don't care or want to know about for example "servername" or "location".


There are a number of ways of excluding differences that are not of interest:

1. Remove the uninteresting elements/data from the input files prior to comparison.  Some example filtering techniques are described on our website:  http://www.deltaxml.com/library/how-to-ignore-elements.html

2. Preprocessing/two-pass approaches which preserve data are also possible:  http://www.deltaxml.com/library/how-to-treat-timestamps.html

3. Compare the original files and ignore the uninteresting differences in the delta.  The structure of the delta generally matches the tree structure of the input data. It  is possible to ignore uninteresting or further post process the changes which are important to you by matching them using XPath in the result.  This could include a simple element name or a more detailed, contextual, XPath which includes more precise steps in the XML tree.  For exmaple to ignore changes to the server-name element the following XSLT null/empty template could be used.  The match statement specifies the XPath location of the uninteresting element:


<xsl:template match="config/location[2]/servername[@deltaxml:delta!='unchanged']"/>
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate