Using a stream character, read a file and convert the entry bytes to the indicated encoding. Returns a String. If encoding is not indicated, it is used
the encoding which have the server defined in the file server.xml.
1 file.chars.read
<file.chars.read encoding='encoding'/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aencoding | string | Indicates the encoding of the string which is generated with the result of the file content, for example ISO-8859 or UTF-8. If not specified, the one defined in the configuration file is used for the server. |
Returns | |
---|---|
Type | Description |
String | String of the file content. |
Example
Get a string with the file content and emits the result by the console. Encoding is indicated so the generated string had characters of tje indicated encoding.
Copy
<xsql-script name='file_chars_read_sample1'> <body> <println> <file.chars.read encoding="UTF-8"><file name='test.xml' type='absolute' /></file.chars.read> </println> </body> </xsql-script>