Changes

Jump to navigation Jump to search
3,491 bytes added ,  16:07, 16 November 2013
Created page with "This XQuery Module contains functions to process binary data, including extracting subparts, searching, basic binary operations and conversion between binary a..."
This [[Module Library|XQuery Module]] contains functions to process binary data, including extracting subparts, searching, basic binary operations and conversion between binary and structured forms.

This module is based on the [http://expath.org/spec/binary EXPath Binary Module].

=Conventions=

All functions and errors in this module are assigned to the {{Code|http://expath.org/ns/binary}} namespace, which is statically bound to the {{Code|bin}} prefix.<br/>

=Constants and Conversions=

==bin:hex==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|bin:hex|$in as xs:string?|xs:base64Binary?}}
|-
| '''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 a 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'''
|{{Error|non-numeric-character|#Errors}} the input cannot be parsed as a hexadecimal number.
|}

==bin:bin==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|bin:bin|$in as xs:string?|xs:base64Binary?}}
|-
| '''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 a <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'''
|{{Error|non-numeric-character|#Errors}} the input cannot be parsed as a binary number.
|}

==bin:octal==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|bin:octal|$in as xs:string?|xs:base64Binary?}}
|-
| '''Summary'''
|<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 a <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'''
|{{Error|non-numeric-character|#Errors}} the input cannot be parsed as an octal number.
|}

==bin:to-octets==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|bin:to-octets|$in as xs:base64Binary|xs:integer*}}
|-
| '''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.
|}

==bin:from-octets==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|bin:from-octets|$in as xs:integer*|xs:base64Binary}}
|-
| '''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'''
|{{Error|octet-out-of-range|#Errors}} one of the octets lies outside the range 0 - 255.
|}

...
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu