Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
License

Basic tutorial



This tutorial presents two XML files and the results of the comparison with very simple Rules configurations.

Files to compare

The left file[1] :
   <theRoot>
      <child name="Paul">
         <child2 name="John"/>
         <child1 name="Rick" />
      </child> 
   </theRoot>
The right file[2] :
   <theRoot>
      <child name="Paul">
         <child1 name="Rick" />
         <child2 name="John" value="foo"/>
         <child3/>
      </child> 
   </theRoot>

Default comparison

Main Article: Default comparison

The default comparison between the XML files will present the following result:
tutorial1_1

Comparison with not significant order

Main Article: nodes order

The following Rules configuration specify that[3] :
  • The nodes which have the same node name represent the same node
  • The ordering of nodes is not significant
   <nodeRules defaultComparisonMode="SameNodeName" orderIsSignificant="false">
   </nodeRules>
The comparison will present the following result:
tutorial1_2

Exclude an attribute

Main Article: excluded attributes

The following Rules configuration specify that the "value" attribute is excluded from the comparison[4] :
   <nodeRules defaultComparisonMode="SameNodeName" orderIsSignificant="false">
      <defaultRule>
         <excludeAttributes>
            <attribute name="value" />
         </excludeAttributes>
      </defaultRule>
   </nodeRules>
The comparison will present the following result:
tutorial1_3

Notes

See also


Categories: tutorials

xmldiff Copyright (c) 2024 Herve Girod. All rights reserved.