[MarkLogic Dev General] Regarding md5
Manoj
manojjayaraman at gmail.com
Wed Dec 29 02:23:55 PST 2010
Hi wayne,
I have attached the sample files i created and the xquery code for
which md5 comaprison returned false.
Thanks & Regards
Manoj
On Wed, Dec 29, 2010 at 2:57 AM, Jason Hunter <jhunter at marklogic.com> wrote:
> 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
>
>
>
> _______________________________________________
> 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/20101229/7cdb7166/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.xml
Type: text/xml
Size: 62 bytes
Desc: not available
Url : http://developer.marklogic.com/pipermail/general/attachments/20101229/7cdb7166/attachment-0002.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.xml
Type: text/xml
Size: 78 bytes
Desc: not available
Url : http://developer.marklogic.com/pipermail/general/attachments/20101229/7cdb7166/attachment-0003.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.xqy
Type: application/octet-stream
Size: 136 bytes
Desc: not available
Url : http://developer.marklogic.com/pipermail/general/attachments/20101229/7cdb7166/attachment-0001.obj
More information about the General
mailing list