Function Signature | Function Description | Functions Parameter(s) | Module’s Equivalent Function |
eXist XML DB | |||
util:base-to-integer($number as item(), $base as xs:integer) xs:integer | Converts the number $number from base $base to xs:integer. | $number The number to convert $base The base of $number | dt-conv:string-to-integer($data as xs:string?, $base as xs:integer) as xs:integer? |
util:integer-to-base($number as xs:integer, $base as xs:integer) xs:string | Converts the xs:integer $number (unsigned) into base $base as xs:string. Bases 2, 8, and 16 are supported. | $number The number to convert $base The base of $number | dt-conv:integer-to-string($data as xs:integer?, $base as xs:integer) as xs:string? |
util:binary-to-string($binary-resource as xs:base64Binary?) xs:string? | Returns the contents of a binary resource as an xs:string value. The binary data is transformed into a Java string using the encoding specified in the optional second argument or the default of UTF-8. | $binary-resource The binary resource | dt-conv:base64Binary-to-string($data as xs:base64Binary?) as xs:string? |
util:binary-to-string($binary-resource as xs:base64Binary?, $encoding as xs:string) xs:string? | Returns the contents of a binary resource as an xs:string value. The binary data is transformed into a Java string using the encoding specified in the optional second argument or the default of UTF-8. | $binary-resource The binary resource $encoding The encoding type. i.e. 'UTF-8' | dt-conv:base64Binary-to-string($data as xs:base64Binary?, $encoding as xs:string) as xs:string? |
util:string-to-binary($encoded-string as xs:string?) xs:base64Binary? | Returns the contents of a string as an base64binary value. The string data is transformed into a binary using the encoding specified in the optional second argument or the default of UTF-8. | $encoded-string The string containing the encoded binary resource | dt-conv:string-to-base64Binary($data as xs:string?) as xs:base64Binary? |
util:string-to-binary($encoded-string as xs:string?, $encoding as xs:string) xs:base64Binary? | Returns the contents of a string as a base64binary value. The string data is transformed into a binary using the encoding specified in the optional second argument or the default of UTF-8. | $encoded-string The string containing the encoded binary resource $encoding the encoding type. i.e. 'UTF-8' | dt-conv:string-to-base64Binary($data as xs:string?, $encoding as xs:string) as xs:base64Binary? |
util:base64-decode($string as xs:string?) xs:string? | Decode the given Base64 encoded string back to clear text Returns the decoded output | $string The Base64 string to be decoded | |
util:base64-encode($string as xs:string?) xs:string? | Encodes the given string as Base64 Returns the Base64 encoded output, with trailing newlines trimmed | $string The string to be Base64 encoded | |
util:base64-encode($string as xs:string?, $trim as xs:boolean) xs:string? | Encodes the given string as Base64 Returns the Base64 encoded output | $string The string to be Base64 encoded $trim Trim trailing newlines? | |
util:int-to-octal($int as xs:int) as xs:string | Converts an int e.g. 511 to an octal number e.g. 0777. | $int The int to convert to an octal string. | |
util:octal-to-int($octal as xs:string) as xs:int | Converts an octal string e.g. '0777' to an int e.g. 511. | $octal The octal string to convert to an int. | |
BaseX XML DB | |||
convert:binary-to-string($bytes as basex:binary) as xs:string | Converts the specifed binary data (xs:base64Binary, xs:hexBinary) to a string. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:base64Binary-to-string($data as xs:base64Binary?) as xs:string? dt-conv:hexBinary-to-string($data as xs:hexBinary?) as xs:string? | |
convert:binary-to-string($bytes as basex:binary, $encoding as xs:string) as xs:string | Converts the specifed binary data (xs:base64Binary, xs:hexBinary) to a string. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:base64Binary-to-string($data as xs:base64Binary?, $encoding as xs:string) as xs:string? dt-conv:hexBinary-to-string($data as xs:hexBinary?, $encoding as xs:string) as xs:string? | |
convert:string-to-base64($input as xs:string) as xs:base64Binary | Converts the specified string to a xs:base64Binary item. If the default encoding is chosen, conversion will be cheap, as both xs:string and xs:base64Binary items are internally represented as byte arrays. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:string-to-base64Binary($data as xs:string?) as xs:base64Binary? | |
convert:string-to-base64($input as xs:string, $encoding as xs:string) as xs:base64Binary | Converts the specified string to a xs:base64Binary item. If the default encoding is chosen, conversion will be cheap, as both xs:string and xs:base64Binary items are internally represented as byte arrays. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:string-to-base64Binary($data as xs:string?, $encoding as xs:string) as xs:base64Binary? | |
convert:string-to-hex($input as xs:string) as xs:hexBinary | Converts the specified string to a xs:hexBinary item. If the default encoding is chosen, conversion will be cheap, as both xs:string and xs:hexBinary items are internally represented as byte arrays. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:string-to-hexBinary($data as xs:string?) as xs:hexBinary? | |
convert:string-to-hex($input as xs:string, $encoding as xs:string) as xs:hexBinary | Converts the specified string to a xs:hexBinary item. If the default encoding is chosen, conversion will be cheap, as both xs:string and xs:hexBinary items are internally represented as byte arrays. The UTF-8 default encoding can be overwritten with the optional $encoding argument. | dt-conv:string-to-hexBinary($data as xs:string?, $encoding as xs:string) as xs:hexBinary? | |
convert:bytes-to-base64($input as xs:byte*) as xs:base64Binary | Converts the specified byte sequence to a xs:base64Binary item. Conversion is cheap, as xs:base64Binary items are internally represented as byte arrays. | dt-conv:byte-to-base64Binary($data as xs:byte*) as xs:base64Binary? | |
convert:bytes-to-hex($input as xs:byte*) as xs:hexBinary | Converts the specified byte sequence to a xs:hexBinary item. Conversion is cheap, as xs:hexBinary items are internally represented as byte arrays. | dt-conv:byte-to-hexBinary($data as xs:byte*) as xs:hexBinary? | |
convert:binary-to-bytes($bin as basex:binary) as xs:byte* | Returns the specified binary data (xs:base64Binary, xs:hexBinary) as a sequence of bytes. | dt-conv:base64Binary-to-byte($data as xs:base64Binary?) as xs:byte* dt-conv:hexBinary-to-byte($data as xs:hexBinary?) as xs:byte* | |
convert:integer-to-base($num as xs:integer, $base as xs:integer) as xs:string | Converts $num to base $base, interpreting it as a 64-bit unsigned integer. The first $base elements of the sequence '0',..,'9','a',..,'z' are used as digits. Valid bases are 2, .., 36. | dt-conv:integer-to-string($data as xs:integer?, $base as xs:integer) as xs:string? | |
convert:integer-from-base($str as xs:string, $base as xs:integer) as xs:integer | Decodes an xs:integer from $str, assuming that it's encoded in base $base. The first $base elements of the sequence '0',..,'9','a',..,'z' are allowed as digits, case doesn't matter. Valid bases are 2 - 36. | dt-conv:string-to-integer($data as xs:string?, $base as xs:integer) as xs:integer? | |
MarkLogic XML DB | |||
xdmp:hex-to-integer( | Parses a hexadecimal string, returning an integer. | $hex The hexadecimal string. | dt-conv:string-to-integer($data as xs:string?, $base as xs:integer) as xs:integer? |
xdmp:integer-to-hex( | Returns a hexadecimal representation of an integer. | $val The integer value. | dt-conv:integer-to-string($data as xs:integer?, $base as xs:integer) as xs:string? |
xdmp:integer-to-octal( | Returns an octal representation of an integer. | $val The integer value. | dt-conv:integer-to-string($data as xs:integer?, $base as xs:integer) as xs:string? |
xdmp:octal-to-integer( | Parses an octal string, returning an integer. | $octal The octal string. | dt-conv:string-to-integer($data as xs:string?, $base as xs:integer) as xs:integer? |
Zorba XQuery Processor | |||
base64:decode($base64 as xs:base64Binary) as xs:string external | Decode a xs:base64Binary. The function assumes that the content after decoding is valid UTF-8. http://stackoverflow.com/questions/2682006/how-to-convert-an-8-bit-integer-into-a-binary-string-in-xquery | $base64 The xs:base64Binary item to decode | dt-conv:base64Binary-to-string($data as xs:base64Binary?) as xs:string? |
decode($base64 as xs:base64Binary, $encoding as xs:string) as xs:string external | Decode a xs:base64Binary. The function assumes that the content after decoding has the given encoding. | $base64 The xs:base64Binary item to decode $encoding The encoding of the string after base64 decoding it. | dt-conv:base64Binary-to-string($data as xs:base64Binary?, $encoding as xs:string) as xs:string? |
encode($string as xs:string) as xs:base64Binary external | Encode a xs:string as xs:base64Binary. | $string The item whose string-value should be encoded | dt-conv:string-to-base64Binary($data as xs:string?) as xs:base64Binary? |
https://github.com/abarax/xquery-utilities/blob/master/base64-encode-decode.xq
http://woerteler.de/xquery/modules/
http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/DatatypeConverter.html
http://jenitennison.com/datatypes/DTLL.html