Hi David,<div><br></div><div>Thanks, but xdmp:binary-size() doesn&#39;t seem to be available on ML 4.2 , am I correct ? If so, what is my alternative ?</div><div><br></div><div>Regards,<br>Danny<br><div><br><div class="gmail_quote">

On Tue, Aug 14, 2012 at 9:08 AM, David Lee <span dir="ltr">&lt;<a href="mailto:David.Lee@marklogic.com" target="_blank">David.Lee@marklogic.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">For XML documents the size is not defined exactly.  What is stored on disk is not the text serialized form, and there are multiple serialized forms for an XML document.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">You can retrieve the document and convert it to a string like<u></u><u></u></span></p><p class="MsoNormal">

<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">    fn:string-length( xs:string(doc(&quot;file.xml&quot;)))<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">That should give you something close but is a heavy operation (requires fetching and serializing the document) and may or may not be the same size as when you really extract and store the document.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">For binary documents see:<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><a href="http://developer.marklogic.com/pubs/5.0/apidocs/Ext-7.html#xdmp:binary-size" target="_blank">http://developer.marklogic.com/pubs/5.0/apidocs/Ext-7.html#xdmp:binary-size</a><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">But like XML documents you  need to extract the document to calculate its size.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Another proposition is to store as a document property the size ... again, for XML this size is not a constant but a function of the serialization used.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">-----------------------------------------------------------------------------<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">David Lee<br>Lead Engineer<br>MarkLogic Corporation<br></span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><a href="mailto:dlee@marklogic.com" target="_blank">dlee@marklogic.com</a><br>

</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">Phone: <a href="tel:%2B1%20650-287-2531" value="+16502872531" target="_blank">+1 650-287-2531</a><br>Cell:  <a href="tel:%2B1%20812-630-7622" value="+18126307622" target="_blank">+1 812-630-7622</a></span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><br>

<a href="http://www.marklogic.com/" target="_blank"><span style="color:blue">www.marklogic.com</span></a><br><br></span><span style="font-size:9.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and delete all copies. Thank you for your cooperation.</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">

<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:general-bounces@developer.marklogic.com" target="_blank">general-bounces@developer.marklogic.com</a> [mailto:<a href="mailto:general-bounces@developer.marklogic.com" target="_blank">general-bounces@developer.marklogic.com</a>] <b>On Behalf Of </b>Danny Sinang<br>

<b>Sent:</b> Tuesday, August 14, 2012 9:03 AM<br><b>To:</b> general<br><b>Subject:</b> [MarkLogic Dev General] Size of xml and binary documents<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">
Hi,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">In ML 4.2, how do you get the size of both xml and binary documents ?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p>

</div><div><p class="MsoNormal">Regards,<u></u><u></u></p></div><div><p class="MsoNormal">Danny<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div>

</div></div></div><br>_______________________________________________<br>
General mailing list<br>
<a href="mailto:General@developer.marklogic.com">General@developer.marklogic.com</a><br>
<a href="http://developer.marklogic.com/mailman/listinfo/general" target="_blank">http://developer.marklogic.com/mailman/listinfo/general</a><br>
<br></blockquote></div><br></div></div>