Ah 4.2, missed that.

The best I can find so far is :

   fn:string-length( xs:string($node)) idiv 2

I would love to hear of a better solution.




-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 650-287-2531
Cell:  +1 812-630-7622
www.marklogic.com<http://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: [email protected] 
[mailto:[email protected]] On Behalf Of Danny Sinang
Sent: Tuesday, August 14, 2012 9:15 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Size of xml and binary documents

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 
<[email protected]<mailto:[email protected]>> 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
[email protected]<mailto:[email protected]>
Phone: +1 650-287-2531<tel:%2B1%20650-287-2531>
Cell:  +1 812-630-7622<tel:%2B1%20812-630-7622>
www.marklogic.com<http://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: 
[email protected]<mailto:[email protected]>
 
[mailto:[email protected]<mailto:[email protected]>]
 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
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to