Hi Manoj,

The md5 function takes a string, so you're only acting on the character data. 
Try using xdmp:quote() to turn the XML tree into text and then calling md5() on 
the quoted text.

Wayne

Manoj <[email protected]> wrote:



Hi all,
   I was trying my hand on the xdmp:md5 api as we intended to use it for our 
project. When we trying to understand how this md5 api works and were trying 
some scenarios. One such scenario which we tested is given below

let $xml1 :=<root><a>a</a><b>b</b></root>
let $xml2 :=<root><a>a</a><z><x>b</x></z></root>
let $xml11 :='<root><a>a</a><b>b</b></root>'
let $xml21 :='<root><a>a</a><z><x>b</x></z></root>'
let $a := xdmp:md5($xml1)
let $b := xdmp:md5($xml2)
let $a1 := xdmp:md5($xml11)
let $b1 := xdmp:md5($xml21)
return (deep-equal($a,$b),deep-equal($a1,$b1))
In the above code md5 value for $a and $b are identical inspite of $xml2 having 
additional node. Where as $a1 and $b1 returned different md5 values. It would 
be great if someone can throw some light on how md5 value is generated in 
marklogic and what are things it considers while generating the md5 value.

Regards,
Manoj
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to