[MarkLogic Dev General] Size of xml and binary documents

Danny Sinang d.sinang at gmail.com
Tue Aug 14 06:14:31 PDT 2012


Hi David,

Thanks, but xdmp:binary-size() doesn't seem to be available on ML 4.2 , am
I correct ? If so, what is my alternative ?

Regards,
Danny

On Tue, Aug 14, 2012 at 9:08 AM, David Lee <David.Lee at marklogic.com> wrote:

> 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.****
>
> You can retrieve the document and convert it to a string like****
>
> ** **
>
>     fn:string-length( xs:string(doc("file.xml")))****
>
> ** **
>
> 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.****
>
> ** **
>
> For binary documents see:****
>
> ** **
>
> http://developer.marklogic.com/pubs/5.0/apidocs/Ext-7.html#xdmp:binary-size
> ****
>
> ** **
>
> ** **
>
> But like XML documents you  need to extract the document to calculate its
> size.****
>
> ** **
>
> 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.****
>
> ** **
>
>
> -----------------------------------------------------------------------------
> ****
>
> David Lee
> Lead Engineer
> MarkLogic Corporation
> dlee at marklogic.com
> Phone: +1 650-287-2531
> Cell:  +1 812-630-7622
> www.marklogic.com
>
> 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.****
>
> ** **
>
> *From:* general-bounces at developer.marklogic.com [mailto:
> general-bounces at developer.marklogic.com] *On Behalf Of *Danny Sinang
> *Sent:* Tuesday, August 14, 2012 9:03 AM
> *To:* general
> *Subject:* [MarkLogic Dev General] Size of xml and binary documents****
>
> ** **
>
> Hi,****
>
> ** **
>
> In ML 4.2, how do you get the size of both xml and binary documents ?****
>
> ** **
>
> Regards,****
>
> Danny****
>
> ** **
>
> ** **
>
> _______________________________________________
> 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/20120814/b79792ff/attachment-0001.html 


More information about the General mailing list