Changes

Jump to navigation Jump to search
829 bytes removed ,  13:18, 16 September 2016
=Conventions=
All functions and errors in this module are assigned to the {{Code|<code><nowiki>http://expath.org/ns/binary}} </nowiki></code> namespace, which is statically bound to the {{Code|bin}} prefix.<br/>
=Constants and Conversions=
|-
| '''Summary'''
|Returns the binary form of the set of octets written as a sequence of (ASCII) hex digits ([0-9A-Fa-f]).<br />{{Code|$in}} will be effectively zero-padded from the left to generate an integral number of octets, i.e. an even number of hexadecimal digits. If {{Code|$in}} is an empty string, then the result will be an {{Code|xs:base64Binary}} with no embedded data.<br/>Byte order in the result follows (per-octet) character order in the string.<br/>If the value of {{Code|$in}} is the empty sequence, the function returns an empty sequence.
|-
| '''Errors'''
|-
| '''Examples'''
|<code>string(bin:hex('11223F4E'))</code> yields <code>ESI/Tg==</code>.<br/><code>string(xs:hexBinary(bin:hex('FF')))</code> yields <code>FF</code>.
|}
|-
| '''Summary'''
|Returns the binary form of the set of octets written as a sequence of (8-wise) (ASCII) binary digits ([01]).<br/><code>$in</code> will be effectively zero-padded from the left to generate an integral number of octets. If <code>$in</code> is an empty string, then the result will be an <code>xs:base64Binary</code> with no embedded data.<br/>Byte order in the result follows (per-octet) character order in the string.<br/>If the value of <code>$in</code> is the empty sequence, the function returns an empty sequence.
|-
| '''Errors'''
|-
| '''Examples'''
|<code>string(bin:bin('1101000111010101'))</code> yields <code>0dU=</code>.<br/><code>string(xs:hexBinary(bin:bin('1000111010101')))</code> yields <code>11D5</code>.
|}
|-
| '''Summary'''
|Returns the binary form of the set of octets written as a sequence of (ASCII) octal digits ([0-7]).<br/><code>$in</code> will be effectively zero-padded from the left to generate an integral number of octets. If <code>$in</code> is an empty string, then the result will be an <code>xs:base64Binary</code> with no embedded data.<br/>Byte order in the result follows (per-octet) character order in the string.<br/>If the value of <code>$in</code> is the empty sequence, the function returns an empty sequence.
|-
| '''Errors'''
|-
| '''Examples'''
|<code>string(xs:hexBinary(bin:octal('11223047')))</code> yields <code>252627</code>.
|}
|-
| '''Summary'''
|Returns binary data as a sequence of octets.<br/>If <code>$in</code> is a zero length binary data then the empty sequence is returned.<br/>Octets are returned as integers from 0 to 255.
|}
|-
| '''Summary'''
|Converts a sequence of octets into binary data.<br/>Octets are integers from 0 to 255.<br/>If the value of <code>$in</code> is the empty sequence, the function returns zero-sized binary data.
|-
| '''Errors'''
=Basic Operations=
==bin:hexlength==
{| width='100%'
|-
|-
| width='120' | '''Signatures'''
|{{Func|bin:part|$in as xs:base64Binary?, $offset as xs:integer|xs:base64Binary?}}<br/>{{Func|bin:part|$in as xs:base64Binary?, $offset as xs:integer, $size as xs:integer|xs:base64Binary?}}
|-
| '''Summary'''
|Returns a section of binary data starting at the {{Code|$offset}} octet.<br/>If {{Code|$size}} is specified, the size of the returned binary data is {{Code|$size}} octets. If {{Code|$size}} is absent, all remaining data from {{Code|$offset}} is returned.<br/>The {{Code|$offset}} is zero based.<br/>If the value of {{Code|$in}} is the empty sequence, the function returns an empty sequence.
|-
| '''Errors'''
|{{Error|negative-offset|#Errors}} the specified offset is negative.<br/>{{Error|negative-size|#Errors}} the specified size is negative.<br/>{{Error|offsetindex-out-beyondof-endrange|#Errors}} the specified offset + size extends beyond the binary datais out of range.
|-
| '''Examples'''
|-
| '''Errors'''
|{{Error|negativeindex-offset|#Errors}} the specified offset is negative.<br/>{{Error|offsetout-beyondof-endrange|#Errors}} the specified offset extends beyond the binary datais out of range.
|}
|-
| '''Summary'''
|Returns the first location of the binary search sequence in the input, or if not found, the empty sequence.<br/>The {{Code|$offset }} and the returned location are zero based. If the value of {{Code|$in }} is the empty sequence, the function returns an empty sequence.
|-
| '''Errors'''
|{{Error|negativeindex-offset|#Errors}} the specified offset is negative.<br/>{{Error|offsetout-beyondof-endrange|#Errors}} the specified offset extends beyond the binary data.<br/>{{Error|empty-search-item|#Errors}} the specified search data + size is emptyout of range.
|}
|-
| '''Errors'''
|{{Error|negative-offset|#Errors}} the specified offset is negative.<br/>{{Error|negative-size|#Errors}} the specified size is negative.<br/>{{Error|offsetindex-out-beyondof-endrange|#Errors}} the specified offset + size extends beyond the binary datais out of range.<br/>{{Error|unknown-encoding|#Errors}} the specified encoding is unknown.<br/>{{Error|decodingconversion-error|#Errors}} an error or malformed input occurred during decoding the string.
|-
| '''Examples'''
|-
| '''Errors'''
|{{Error|unknown-encoding|#Errors}} the specified encoding is unknown.<br/>{{Error|encodingconversion-error|#Errors}} an error or malformed input occurred during encoding the string.
|}
|-
| width='120' | '''Signatures'''
|{{Func|bin:pack-float|$in as xs:doublefloat|xs:base64Binary}}<br/>{{Func|bin:pack-float|$in as xs:doublefloat, $octet-order as xs:string|xs:base64Binary}}
|-
| '''Summary'''
|-
| width='120' | '''Signatures'''
|{{Func|bin:pack-integer|$in as xs:doubleinteger, $size as xs:integer|xs:base64Binary}}<br/>{{Func|bin:pack-floatinteger|$in as xs:doubleinteger, $size as xs:integer, $octet-order as xs:string|xs:base64Binary}}
|-
| '''Summary'''
|-
| '''Errors'''
|{{Error|negativeindex-offset|#Errors}} the specified offset is negative.<br/>{{Error|offsetout-beyondof-endrange|#Errors}} the specified offset + 8 extends beyond the binary datais out of range.<br/>{{Error|unknown-significance-order|#Errors}} the specified octet order is unknown.
|}
|-
| width='120' | '''Signatures'''
|{{Func|bin:unpack-float|$in as xs:base64Binary, $offset as xs:integer|xs:doublefloat}}<br/>{{Func|bin:unpack-float|$in as xs:base64Binary, $offset as xs:integer, $octet-order as xs:string|xs:float}}
|-
| '''Summary'''
|-
| '''Errors'''
|{{Error|negativeindex-offset|#Errors}} the specified offset is negative.<br/>{{Error|offsetout-beyondof-endrange|#Errors}} the specified offset + 4 extends beyond the binary datasize is out of range.<br/>{{Error|unknown-significance-order|#Errors}} the specified octet order is unknown.
|}
|-
| width='120' | '''Signatures'''
|{{Func|bin:unpack-integer|$in as xs:base64Binary, $offset as xs:integer, $size as xs:integer|xs:doubleinteger}}<br/>{{Func|bin:unpack-integer|$in as xs:base64Binary, $offset as xs:integer, $size as xs:integer, $octet-order as xs:string|xs:floatinteger}}
|-
| '''Summary'''
|-
| '''Errors'''
|{{Error|negative-offset|#Errors}} the specified offset is negative.<br/>{{Error|negative-size|#Errors}} the specified size is negative.<br/>{{Error|offsetindex-out-beyondof-endrange|#Errors}} the specified offset + 4 extends beyond the binary datasize is out of range.<br/>{{Error|unknown-significance-order|#Errors}} the specified octet order is unknown.
|}
|-
| width='120' | '''Signatures'''
|{{Func|bin:unpack-unsigned-integer|$in as xs:base64Binary, $offset as xs:integer, $size as xs:integer|xs:doubleinteger}}<br/>{{Func|bin:unpack-unsigned-integer|$in as xs:base64Binary, $offset as xs:integer, $size as xs:integer, $octet-order as xs:string|xs:floatinteger}}
|-
| '''Summary'''
|-
| '''Errors'''
|{{Error|negative-offset|#Errors}} the specified offset is negative.<br/>{{Error|negative-size|#Errors}} the specified size is negative.<br/>{{Error|offsetindex-out-beyondof-endrange|#Errors}} the specified offset + 4 extends beyond the binary datasize is out of range.<br/>{{Error|unknown-significance-order|#Errors}} the specified octet order is unknown.
|}
|-
| '''Summary'''
|Shifts bits in binary data.<br/>If {{Code|$by}} is zero, the result is identical to {{Code|$in}}. If {{Code|$by}} is positive then bits are shifted to the left. Otherwise, bits are shifted to the right. If the absolute value of <code>|$by|</code> is greater than the bit-length of {{Code|$in}} then an all-zeros result is returned. The result always has the same size as {{Code|$in}}. The shifting is logical: zeros are placed into discarded bits. If the value of {{Code|$in}} is the empty sequence, the function returns an empty sequence.
|}
{| class="wikitable" width="100%"
! width="110240"|Code
|Description
|-
|The arguments to a bitwise operation have different lengths.
|-
|{{Code|negativeindex-offset}}|An offset value is negative.|-|{{Code|offsetout-beyondof-endrange}}|An offset value extends beyond the binary datais out of range.
|-
|{{Code|negative-size}}
|A size value is negative.
|-
|{{Code|empty-search-item}}
|Binary search data is empty.
|-
|{{Code|octet-out-of-range}}
|An encoding is not supported.
|-
|{{Code|decodingconversion-error}}|An error or malformed input during decoding a string.|-|{{Code|decoding-error}}|An error or malformed input during encoding converting a string.
|-
|{{Code|unknown-significance-order}}
Introduced with Version 7.8.
 
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu