Convert a byte array into a string of hexadecimal digits characters (two characters by byte).
 

1 byte.toHexString

<byte.toHexString>
    <data /> !
</byte.toHexString>

Exceptions

requires 1 values, received [...]

It has been specified an incorrect number of values.

Remarks

It is accepted as value any type of convertible data to an array byte: a string, an array of bytes, a node (of a XML or HTML file), a BLOB (Binary Large Object) or a file.

Example

Converts a string to hex.

Copy
<xsql-script name='byte_toHexString_sample1'>
    <body>
        <set name='contenido'>
          Hello world
        </set>
        <println>
          <byte.toHexString>
            <contenido />
          </byte.toHexString>
       </println>
    </body>
</xsql-script>

The result is:

Copy
0A2020202020202020202048656C6C6F20776F726C640A2020202020202020
Example

Converts the content of a file to hex.

Copy
<xsql-script name='byte_toHexString_sample2'>
    <body>
        <set name='content'>
            <byte.toHexString>
                <file name='z:\test.xml' type='absolute' />
            </byte.toHexString>
        </set>
        <println>
            <content />
        </println>
    </body>
</xsql-script>

The result is:

Copy
56C6C6F20776F726C640A2020256C6C6F20776F726C640A2020256C6C6F20776F726C640A2020256C6C6F20776F726C640A202026461467136456156C6C6F20776F726C640A2020256C6C6F20776F726C640A20202