Write on the file indicated as first argument the data (chars) of the stream indicated as second argument. Allows to convert streams of an encoding
to another one. It means that the encoding of both arguments can be indicated (file and stream to write).
1 file.chars.write
<file.chars.write
append='true|false'
encoding-src='encoding-src'
encoding-src='encoding-src'
/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aappend | boolean | false | Indicates if the text should be added to the file or otherwise the content should be replaced with the new text passed in this function (default option). | ||
Aencoding-src | string | Indicates the encoding of the characters in destination, it means how they must be written in the file, for example ISO-8859-1 or UTF-8. If not specified, the one defined in the configuration file server.xml for the server is used. | |||
Aencoding-src | stream | Indicates the encoding of the strem that will be written to the file, for example ISO-8859-1 or UTF-8. If not specified, the one defined in the configuration file server.xml for the server is used. |
Returns | |
---|---|
Type | Description |
Integer | Number of written characters. |
Example
Write in a file an origin stream.
Copy
<xsql-script name='file_chars_write_sample'> <body> <set name='m_file'> <string>c:<file.separator />source<file.separator />deister.txt</string> </set> <file.chars.write append='true' encoding-src='ISO-8859-1' encoding-dst='ISO-8859-1'> <file name='#m_file' type='absolute' /> <string>This text is added to the file.</string> </file.out.open> </body> </xsql-script>