EDN Admin
Well-known member
Hi<br/>
<br/>
I am trying to use XmlDiff for our internal application. And i came across some examples which were not giving correct results.<br/>
<br/>
To the diff patch tool, if we gave 2 xml files containing below input, it gave output as identical<br/>
<br/>
Input 1 <br/>
<br/>
<root1><br/>
<a x="3" y="6" z="abc" /><br/>
</root1><br/>
<br/>
Input2<br/>
<br/>
<root1><br/>
<a x="1" y="8" z="abc"/><br/>
</root1><br/>
<br/>
As you can see, values for attributes x and y are different across the 2 xmls and ideally it shldnt say they are identical. When i looked at the code further, i saw that in method (for class XmlDiffElement)<br/>
<br/>
// compares the node to another one and returns true, if the nodes are identical;<br/>
// on elements this method ignores namespace declarations<br/>
internal override bool IsSameAs( XmlDiffNode node, XmlDiff xmlDiff )<br/>
<br/>
line<br/>
<br/>
XmlDiffAttributeOrNamespace attr2 = _attributes;<br/>
<br/>
shld be<br/>
<br/>
XmlDiffAttributeOrNamespace attr2 = element._attributes;<br/>
<br/>
I could figure out that somehow the hashvalue for element "a" was the same in both xmls. And it was not properly considering
<br/>
attributes equality (as the code above showed). Is it possible to get this fixed and could a patch be given?
View the full article
<br/>
I am trying to use XmlDiff for our internal application. And i came across some examples which were not giving correct results.<br/>
<br/>
To the diff patch tool, if we gave 2 xml files containing below input, it gave output as identical<br/>
<br/>
Input 1 <br/>
<br/>
<root1><br/>
<a x="3" y="6" z="abc" /><br/>
</root1><br/>
<br/>
Input2<br/>
<br/>
<root1><br/>
<a x="1" y="8" z="abc"/><br/>
</root1><br/>
<br/>
As you can see, values for attributes x and y are different across the 2 xmls and ideally it shldnt say they are identical. When i looked at the code further, i saw that in method (for class XmlDiffElement)<br/>
<br/>
// compares the node to another one and returns true, if the nodes are identical;<br/>
// on elements this method ignores namespace declarations<br/>
internal override bool IsSameAs( XmlDiffNode node, XmlDiff xmlDiff )<br/>
<br/>
line<br/>
<br/>
XmlDiffAttributeOrNamespace attr2 = _attributes;<br/>
<br/>
shld be<br/>
<br/>
XmlDiffAttributeOrNamespace attr2 = element._attributes;<br/>
<br/>
I could figure out that somehow the hashvalue for element "a" was the same in both xmls. And it was not properly considering
<br/>
attributes equality (as the code above showed). Is it possible to get this fixed and could a patch be given?
View the full article