Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp.subbinary

xdmp.subbinary(
   source as binary(),
   starting-location as Number,
   [length as Number]
) as binary()

Summary

Returns a binary node made up of a subset of the given binary node.

Parameters
source A binary node whose subset will be returned
starting-location The new binary node starts at the byte position indicated by starting-location. The first byte is at location 1.
length The length in bytes of the new binary node.

Usage Notes

Usage is exactly like fn:substring except that it applies to a binary node rather than a string.

Example

var node = new NodeBuilder();
var bin = node.addBinary( "DEADBEEF" ).toNode();
xdmp.describe(fn.data(xdmp.subbinary(bin, 3, 2)));
  => xs:hexBinary("BEEF")

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.