# xf:base64Binary

Converts $string-var (a string) to a base64 encoded arbitrary binary data.

If the value of $string-var is the empty sequence, the following error is displayed in the mapper:

    Error occured while executing XQuery: Error loading the XQuery or XSLT for this method: Type error in function base64Binary invocation: expected type [string@http://www.w3.org/2001/XMLSchema], given type empty

The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

### Signatures

xf:base64Binary(xs:string $string-var) —> xs:base64Binary

### Arguments

Data Type | Argument | Description
--- | --- | ---
xs:string | $string-var | Represents the string to convert to a base 64 number.

### Returns

Returns base 64 binary value of $string-var.

### Examples

Note: I took this from the test cases, is there a better example?

#### Simple

Invoking base64Binary("AaaaAAAA") returns the base64 binary value of AaaaAAAA, as shown in the following example query:

    <result>{xf:base64Binary("AaaaAAAA")}</result>

The preceding query generates the following result:

    <result>AaaaAAAA</result>

Related Topics

W3C base64Binary data type description.