|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified path does not exist.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified file does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified file points to a directory.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the specified path cannot be transformed to its native representation.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0003]]</b> is raised if the specified path does not point to a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0002]]</b> is raised if a file with the same path already exists.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified path does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified file does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0005]]</b> is raised if the specified encoding is not supported, or unknown.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified file does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0005]]</b> is raised if the specified encoding is not supported, or unknown.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified file does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|Writes a sequence of <code>$items</code> to a file specified by <code>$path</code>. If the specified file already exists, it will be overwritten.<br />The optional argument <code>$params</code> is used to set the serialization parameters (see [[Serialization]] for more details).It can be specified as<br />
* <code>element(serialization-parameters)</code>: <code><serialization-parameters/></code> must be used as root element, and the parameters are specified as child nodes, with the element name representing the serialization parameter and the attribute <code>value</code> representing its value:<br /><code><serialization-parameters xmlns="http://www.w3.org/2010/xslt-xquery-serialization"><br/> <method value='xml'/><br/> <cdata-section-elements value="div"/><br/> ...<br/></serialization-parameters></code>
* [[Map_FunctionsMap Module|map structure]]: all parameters can be directly represented as key/value pairs:<br /><code>map { "method" := "xml", "cdata-section-elements" := "div", ... </code>}<br/>
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0004]]</b> is raised if the specified path is a directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified source does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0002]]</b> is raised if the specified source is a directory and the target is a file.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0003]]</b> is raised if the parent of the specified target is no directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
|-
| valign='top' | '''Errors'''
|<b>[[XQuery Errors#File Functions Module Errors|FOFL0001]]</b> is raised if the specified source does not exist.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0002]]</b> is raised if the specified source is a directory and the target is a file.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0003]]</b> is raised if the parent of the specified target is no directory.<br /><b>[[XQuery Errors#File Functions Module Errors|FOFL0000]]</b> is raised if the operation fails for some other reason.<br />
|}
[[Category:XQuery]]