It looks like the difference has to do with white space. I loaded your
two documents into my database and ran the following.
xquery version "1.0-ml";
let $a := fn:doc("/file1.xml")
let $b := fn:doc("/file2.xml")
return (
xdmp:describe(fn:data($a)),
xdmp:describe(fn:data($b))
)
The result was
xs:untypedAtomic(" a b ")
xs:untypedAtomic(" a b ")
Wayne.
On 12/29/2010 02:23 AM, Manoj wrote:
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 <[email protected]
<mailto:[email protected]>> 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
<[email protected] <mailto:[email protected]>> 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<[email protected] <mailto:[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]
<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
--
Wayne Feick
Principal Engineer
MarkLogic Corporation
Phone +1 650 655 2378
Cell +1 408 981 4576
www.marklogic.com
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general