rule
elements which define for each rule:defaultRule
element is defined. For example here a default rule is defined, for which nodes will be found if their node names are identical: <nodeRules defaultComparisonMode="SameNodeName"> </nodeRules>The most simple way to define the default rule is through the attributes of the
nodeRules
root element of the configuration:AnyDiffOther
). See also comparison mode for more informationtrue
). See also nodes order for more informationfalse
). See also excluding CDATA for more informationfalse
)defaultRule
element in the configuration file. It overrides the properties defined at the root of the configuration file. AnyDiffOther
). See also comparison mode for more informationtrue
). See also nodes order for more informationfalse
). See also excluding CDATA for more informationfalse
)name
attribute by default:<nodeRules> <defaultRule> <identification> <attribute name="name" /> </identification> </defaultRule> </nodeRules>
rule
element in the configuration file. It overrides the properties defined at the root of the configuration file. AnyDiffOther
). See also comparison mode for more informationtrue
). See also nodes order for more informationfalse
). See also excluding CDATA for more informationfalse
)name
attribute:<nodeRules> <rule> <appliesOn> <nodeName name="MyNode" /> </appliesOn> <identification> <attribute name="name" /> </identification> </rule> </nodeRules>
extendsDefaultRule
element specifies if the rule extends the default rule.<nodeRules> <defaultRule> <identification> <attribute name="name" /> </identification> </defaultRule> <rule orderIsSignificant="false"> <extendsDefaultRule /> <appliesOn> <nodeName name="MyNode" /> </appliesOn> </rule> </nodeRules>The
extendsRule
element specifies if the rule extends another rule.
appliesOn
element specifies on which node names the rule is applied. <nodeRules> <rule> <appliesOn> <nodeName name="MyNode" /> <nodeName name="OtherNode" /> </appliesOn> <identification> <attribute name="name" /> </identification> </rule> </nodeRules>
identification
element specifies the attributes which define the node identification. name
and id
define the node identification for nodes which have the node name MyNode
: <nodeRules> <rule> <appliesOn> <nodeName name="MyNode" /> </appliesOn> <identification> <attribute name="name" /> <attribute name="id" /> </identification> </rule> </nodeRules>
excludeAttributes
element specifies the attributes which will be excluded from the comparison. value
attribute is escluded from the description element:<rule> <appliesOn> <nodeName name="description" /> </appliesOn> <excludeAttributes> <attribute name="value" /> </excludeAttributes> </rule>
descriptions
element specifies attributes which will be considered as descriptions. The comparison of these attributes can be a little more lax than the comparison for other attributes. applyRegex
children (optional) specify a regex which an be applied to the attribute value. More than one regex replacement can be defineddescription
child (mandatory) specify the attribute of the element which will be considered as a description<rule> <appliesOn> <nodeName name="description" /> </appliesOn> <descriptions trimType="Trim"> <applyRegex replaceFrom="\s+" replaceTo=" " /> <applyRegex replaceFrom=" " replaceTo="
" /> <description name="value" /> </descriptions> </rule>
CDATA
element specifies how the CDATA content will be compared.false
). See also excluding CDATA for more informationapplyRegex
children (optional) specify a regex which an be applied to the CDATA content. More than one regex replacement can be defined<nodeRules> <defaultRule> <identification> <attribute name="name" /> </identification> <CDATA trimType="TrimRight"> <applyRegex replaceFrom="\s+" replaceTo=" " /> </CDATA> </defaultRule> </nodeRules>
comparisonMode
property specifies the comparison mode. It can have the following values:identity
attributes of the nodes will be used to detect if the nodes are the same or they are different nodes
<theNode name="titi"/> |
<theNode name="toto"/> |
comparisonMode
property is set to "AnyDiffOther"comparisonMode
property is set to "SameNodeName". Note that in this case the nodes will still be considered as updated, except if the name
attribute is escluded from the comparisonorderIsSignificant
property specifies if two nodes which represent the same element are considered as updated if they are in a different index in their parent. child_1
node does not have the same index at the left and at the right:
|
|
orderIsSignificant
property is true, they will be considered as updatedorderIsSignificant
property is false, they will be considered as identicalexcludeCDATA
property specifies if the CDATA content of nodes is used for the comparison. It will not be used if its value is true
.<nodeRules> <defaultRule excludeCDATA="true"> <identification> <attribute name="name" /> </identification> </defaultRule> </nodeRules>is equivalent to:
<nodeRules> <defaultRule> <identification> <attribute name="name" /> </identification> <CDATA excludeCDATA="true" /> </defaultRule> </nodeRules>
xmldiff Copyright (c) 2024 Herve Girod. All rights reserved.