Changes

Jump to navigation Jump to search
1,384 bytes added ,  10:26, 5 June 2012
All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.
=Binary DataString=
==convert:binary-to-string==
{|
|-
| width='90' | '''Signatures'''
|{{Func|convert:binary-to-string|$bytes as basex:binary|xs:string}}<br/>{{Func|convert:binary-to-string|$bytes as basex:binary, $encoding as xs:string|xs:string}}
|-
| '''Summary'''
| '''Examples'''
|
* {{Code|convert:binary-to-string(xs:hexBinary('48656c6c6f576f726c64'))}} returns the string {{Code|HelloWorld}}.
|}
==convert:string-to-base64Binarybase64==
{|
|-
| width='90' | '''Signatures'''
|{{Func|convert:string-to-base64Binarybase64|$input as xs:string|xs:base64Binary}}<br/>{{Func|convert:string-to-base64Binarybase64|$input as xs:string, $encoding as xs:string|xs:base64Binary}}
|-
| '''Summary'''
| '''Examples'''
|
* {{Code|convert:string-to-base64Binarybase64('HelloWorld')}} returns the Base64 xs:base64binary item <code>SGVsbG9Xb3JsZA==</code>.
|}
==convert:string-to-hexBinaryhex==
{|
|-
| width='90' | '''Signatures'''
|{{Func|convert:string-to-hexBinaryhex|$input as xs:string|xs:hexBinary}}<br/>{{Func|convert:string-to-hexBinaryhex|$input as xs:string, $encoding as xs:string|xs:hexBinary}}
|-
| '''Summary'''
| '''Examples'''
|
* {{Code|convert:string-to-hexBinaryhex('HelloWorld')}} returns the Base64 item {{Code|48656C6C6F576F726C64}}.
|}
=Byte Arrays= ==convert:bytes-to-base64=={||-| width='90' | '''Signatures'''|{{Func|convert:bytes-to-base64|$input as xs:byte*|xs:base64Binary}}|-| '''Summary'''|Converts the specified byte sequence to a {{Code|xs:base64Binary}} item. Conversion may be very cheap, as {{Code|xs:base64Binary}} items are internally represented as byte arrays.|-| '''Errors'''|{{Error|BXCO0001|#Errors}} The input cannot be represented in the specified encoding.<br/>{{Error|BXCO0002|#Errors}} The specified encoding is invalid or not supported.|-| '''Examples'''|* {{Code|convert:string-to-base64('HelloWorld')}} returns the xs:base64binary item <code>SGVsbG9Xb3JsZA==</code>.|} ==convert:bytes-to-hex=={||-| width='90' | '''Signatures'''|{{Func|convert:string-to-hex|$input as xs:byte*|xs:hexBinary}}|-| '''Summary'''|Converts the specified byte sequence to a {{Code|xs:hexBinary}} item. Conversion may be very cheap, as {{Code|xs:hexBinary}} items are internally represented as byte arrays.|-| '''Errors'''|{{Error|BXCO0001|#Errors}} The input cannot be represented in the specified encoding.<br/>{{Error|BXCO0002|#Errors}} The specified encoding is invalid or not supported.|-| '''Examples'''|* {{Code|convert:string-to-hex('HelloWorld')}} returns the Base64 item {{Code|48656C6C6F576F726C64}}.|}  ==convert:binary-to-bytes==
{|
|-
| width='90' | '''Signatures'''
|{{Func|convert:binary-to-bytes|$bin as basex:binary|xs:byte*}}
|-
| '''Summary'''
| '''Examples'''
|
* <code>convert:binary-to-bytes(xs:base64Binary('QmFzZVggaXMgY29vbA=='))</code> returns the sequence {{Code|(66, 97, 115, 101, 88, 32, 105, 115, 32, 99, 111, 111, 108)}}.* {{Code|convert:binary-to-bytes(xs:hexBinary("4261736558"))}} returns the sequence {{Code|(66 97 115 101 88)}}.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu