[MarkLogic Dev General] Regarding md5
Jason Hunter
jhunter at marklogic.com
Tue Dec 28 23:57:01 PST 2010
It returns true for me. You're 100% sure you're getting false?
-jh-
On Dec 28, 2010, at 11:47 PM, Manoj wrote:
> Hi Wayne,
> Thanks for the suggestion. We will try using the xdmp:quote function before calculating md5.
>
> Another thing we noticed but forgot to mention earlier is given below
>
> In file1.xml we stored the following content <root><a>a</a><b>b</b></root>
> and in file2.xml we store <root><a>a</a><z><x>b</x></z></root>
>
> when we executed the following code
> let $a := fn:doc('/file1.xml')
> let $b := fn:doc('/file2.xml')
> let $x := xdmp:md5($a)
> let $y := xdmp:md5($b)
>
> return (deep-equal($x,$y))
>
> This returned false. This is more or less similar to first part of the earlier code but the current one returns a document node. Ideally in this case also the md5 should return same for both the $x and $y right? can you throw some light?
>
>
> Thanks & Regards
> Manoj
>
>
> On Wed, Dec 29, 2010 at 2:16 AM, Wayne Feick <Wayne.Feick at marklogic.com> wrote:
> 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 <manojjayaraman at gmail.com> 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
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20101228/c4b8d0ea/attachment.html
More information about the General
mailing list