Difference between revisions of "File Module"
Jump to navigation
Jump to search
m (moved File to File Functions: consistent naming) |
(based on docs2wiki.xq) |
||
Line 1: | Line 1: | ||
− | + | The file module contains extension functions to perform file system related operations, such as listing, reading, or writing files. All functions are preceded by the <code>file:</code> prefix. Some changes might happen to this module, as it is currently aligned with the upcoming [http://expath.org/spec/file EXPath] specification. | |
==file:exists== | ==file:exists== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code> | + | |<code><b>file:exists</b>($path as xs:string) as xs:boolean</code><br /> |
|- | |- | ||
− | | '''Summary''' | + | | valign='top' | '''Summary''' |
− | | Checks if a path exist. | + | |Checks if a path exist. |
|- | |- | ||
− | | '''Rules''' | + | | valign='top' | '''Rules''' |
− | | This | + | |This function returns an <code>xs:boolean</code> indicating whether a file or directory specified by <code>$path</code> exists in the file system.<br /> |
|} | |} | ||
==file:is-directory== | ==file:is-directory== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:is-directory</b>($path as xs:string) as xs:boolean</code> | + | |<code><b>file:is-directory</b>($path as xs:string) as xs:boolean</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Checks if a path points to a directory. | + | |Checks if a path points to a directory. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This | + | |This function returns an <code>xs:boolean</code> indicating whether the argument <code>$path</code> points to an existing directory.<br /> |
|} | |} | ||
− | + | ||
==file:is-file== | ==file:is-file== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:is-file</b>($path as xs:string) as xs:boolean</code> | + | |<code><b>file:is-file</b>($path as xs:string) as xs:boolean</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Checks if a path points to a file. | + | |Checks if a path points to a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This | + | |This function returns an <code>xs:boolean</code> indicating whether the argument <code>$path</code> points to an existing file.<br /> |
− | |} | + | |} |
− | + | ||
==file:is-readable== | ==file:is-readable== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:is-readable</b>($path as xs:string) as xs:boolean</code> | + | |<code><b>file:is-readable</b>($path as xs:string) as xs:boolean</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Checks if a file is readable. | + | |Checks if a file is readable. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This | + | |This function returns an <code>xs:boolean</code> indicating whether the file specified by <code>$path</code> exists and is readable.<br /> |
|} | |} | ||
− | + | ||
==file:is-writable== | ==file:is-writable== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:is-writable</b>($path as xs:string) as xs:boolean</code> | + | |<code><b>file:is-writable</b>($path as xs:string) as xs:boolean</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Checks if a file is | + | |Checks if a file is writable. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This | + | |This function returns an <code>xs:boolean</code> indicating whether the file specified by <code>$path</code> exists and is writable.<br /> |
|} | |} | ||
− | + | ||
==file:last-modified== | ==file:last-modified== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:last-modified</b>($path as xs:string) as xs:dateTime</code> | + | |<code><b>file:last-modified</b>($path as xs:string) as xs:dateTime</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Returns the timestamp of a path. | + | |Returns the timestamp of a path. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function retrieves the timestamp of the last modification of the | + | |This function retrieves the timestamp of the last modification of the file or directory specified by <code>$path</code>.<br /> |
− | | | + | |- |
− | + | | valign='top' | '''Errors''' | |
− | + | |<b>[FOFL0001]</b> is raised if the specified path does not exist.<br /> | |
+ | |} | ||
+ | ==file:size== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file: | + | |<code><b>file:size</b>($path as xs:string) as xs:integer</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Returns the size of a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function returns the size, in bytes, of the file specified by <code>$path</code>. The return value is unspecified if the argument points to a directory.<br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0001]</b> is raised if the specified path does not exist.<br /> |
− | |} | + | |} |
− | |||
− | |||
+ | ==file:list== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | + | |<code><b>file:list</b>($path as xs:string) as xs:string*</code><br /><code><b>file:list</b>($path as xs:string, $recursive as xs:boolean) as xs:string*</code><br /><code><b>file:list</b>($path as xs:string, $recursive as xs:boolean, $pattern as xs:string) as xs:string*</code><br /> | |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Lists the contents of a directory. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function lists all files and directories found in the directory that is specified by <code>$path</code>. The returned paths are relative to the provided path.<br />The optional parameter <code>$recursive</code> specifies whether the sub-directories are to be recursed as well.<br />The optional parameter <code>$pattern</code> defines a file name pattern. If present, only those files and directories are returned that correspond to the pattern. A pattern may contain asterisks (<code>*</code>) to match zero or more characters, and question marks (<code>?</code>) to match single characters. Several patterns can be separated with a comma (<code>,</code>).<br /> |
|- | |- | ||
− | | <b> | + | | valign='top' | '''Errors''' |
− | + | |<b>[FOFL0001]</b> is raised if the specified path does not exist.<br /><b>[FOFL0003]</b> is raised if the specified path does not point to a directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> | |
− | |} | + | |} |
− | |||
− | |||
+ | ==file:create-directory== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file: | + | |<code><b>file:create-directory</b>($path as xs:string) as empty-sequence()</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Creates a new directory path. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function recursively creates the directories specified by <code>$path</code>.<br /> |
|- | |- | ||
− | | <b> | + | | valign='top' | '''Errors''' |
− | + | |<b>[FOFL0002]</b> is raised if a file with the same path already exists.<br /><b>[FOFL0006]</b> is raised if the specified path is invalid (e.g., contains invalid characters).<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> | |
|} | |} | ||
− | |||
− | |||
+ | ==file:delete== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | + | |<code><b>file:delete</b>($path as xs:string) as empty-sequence()</code><br /><code><b>file:delete</b>($path as xs:string, $recursive as xs:boolean) as empty-sequence()</code><br /> | |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Deletes a file or directory. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function deletes a file or directory specified by <code>$path</code>. No operation will be performed if the specified path does not exist.<br />If the optional parameter <code>$recursive</code> is provided, the operation is performed recursively for all sub-directories of the given path.<br /> |
|- | |- | ||
− | | <b> | + | | valign='top' | '''Errors''' |
− | + | |<b>[FOFL0005]</b> is raised if <code>$recursive</code> is not specified or set to <code>false</code>, and if the specified path points to a non-empty directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> | |
|} | |} | ||
− | |||
− | |||
+ | ==file:read== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file: | + | |<code><b>file:read</b>($path as xs:string) as xs:string</code><br /><code><b>file:read</b>($path as xs:string, $encoding as xs:string) as xs:string</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Reads the contents a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function reads the textual contents of the file specified by <code>$path</code> and returns it as a <code>xs:string</code>.<br />The optional parameter <code>$encoding</code> defines the encoding of the file.<br /> |
|- | |- | ||
− | | <b> | + | | valign='top' | '''Errors''' |
− | + | |<b>[FOFL0001]</b> is raised if the specified file does not exist.<br /><b>[FOFL0004]</b> is raised if the specified path is a directory.<br /><b>[FOFL0007]</b> is raised if the specified encoding is not supported, or unknown.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> | |
|} | |} | ||
− | |||
− | |||
+ | ==file:read-binary== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file: | + | |<code><b>file:read-binary</b>($path as xs:string) as xs:base64Binary</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Reads the binary contents of a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function | + | |This function reads the binary content of the file specified by <code>$path</code> and returns as a <code>xs:base64Binary</code>.<br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0001]</b> is raised if the specified file does not exist.<br /><b>[FOFL0004]</b> is raised if the specified path is a directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> |
|} | |} | ||
− | |||
− | |||
+ | ==file:write== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | + | |<code><b>file:write</b>($path as xs:string, $items as xs:item()*) as empty-sequence()</code><br /><code><b>file:write</b>($path as xs:string, $items as xs:item()*, $params as xs:node()*) as empty-sequence()</code><br /><code><b>file:write</b>($path as xs:string, $items as xs:item()*, $params as xs:node()*, $append as xs:boolean) as empty-sequence()</code><br /> | |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Writes a sequence of items to a file. |
|- | |- | ||
− | | < | + | | valign='top' | '''Rules''' |
− | + | |This function writes a sequence, specified by <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, as defined in [http://www.w3.org/TR/xslt-xquery-serialization/ XSLT 2.0 and XQuery 1.0 Serialization].<br />If the <code>$append</code> flag is set to <code>true</code>, the serialized items are appended to the original file. If the file does not exist, a new one is created.<br /> | |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0004]</b> is raised if the specified path is a directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> |
|} | |} | ||
− | |||
− | |||
+ | ==file:write-binary== | ||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file: | + | |<code><b>file:write-binary</b>($path as xs:string, $item as xs:base64Binary) as empty-sequence()</code><br /><code><b>file:write-binary</b>($path as xs:string, $item as xs:base64Binary, $append as xs:boolean) as empty-sequence()</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | | + | |Writes a sequence of items to a file. |
|- | |- | ||
− | | < | + | | valign='top' | '''Rules''' |
− | + | |This function writes a <code>xs:basex64Binary</code> item specified by <code>$item</code> to a file specified by <code>$path</code>. If the specified file already exists, it will be overwritten.<br />If the <code>$append</code> flag is set to <code>true</code>, the serialized item is appended to the original file. If the file does not exist, a new one is created.<br /> | |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0004]</b> is raised if the specified path is a directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> |
|} | |} | ||
==file:copy== | ==file:copy== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:copy</b>($source as xs:string, $target as xs:string) as empty-sequence()</code><br / | + | |<code><b>file:copy</b>($source as xs:string, $target as xs:string) as empty-sequence()</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Copies a file. | + | |Copies a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function copies a file specified by <code>$source</code> to <code>$target</code>. | + | |This function copies a file specified by <code>$source</code> to the file or directory specified by <code>$target</code>. If the target represents an existing file, it will be overwritten. No operation will be performed if the source and target path are equal.<br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0001]</b> is raised if the specified source does not exist.<br /><b>[FOFL0004]</b> is raised if the specified source is a directory.<br /><b>[FOFL0006]</b> is raised if the specified target path points to a file in a non-existing directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> |
|} | |} | ||
==file:move== | ==file:move== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:move</b>($source as xs:string, $target as xs:string) as empty-sequence()</code> | + | |<code><b>file:move</b>($source as xs:string, $target as xs:string) as empty-sequence()</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Moves a file. | + | |Moves a file. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function moves | + | |This function moves, or renames, the file or directory specified by <code>$source</code> to the path specified by <code>$target</code>. No operation will be performed if the source and target path are equal.<br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Errors''' |
− | | <b>[ | + | |<b>[FOFL0001]</b> is raised if the specified source does not exist.<br /><b>[FOFL0006]</b> is raised if the specified target path points to a file in a non-existing directory.<br /><b>[FOFL0008]</b> is raised if the operation fails for some other reason.<br /> |
− | |} | + | |} |
− | + | ||
==file:path-separator== | ==file:path-separator== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:path-separator</b>() as xs:string</code> | + | |<code><b>file:path-separator</b>() as xs:string</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Returns the path separator. | + | |Returns the path separator. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function returns the path separator used by the operating system.<br /> | + | |This function returns the path separator used by the operating system.<br /> |
− | |} | + | |} |
− | + | ||
==file:path-to-full-path== | ==file:path-to-full-path== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:path-to-full-path</b>($path as xs:string) as xs:string</code> | + | |<code><b>file:path-to-full-path</b>($path as xs:string) as xs:string</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Returns a full path representation. | + | |Returns a full path representation. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function transforms | + | |This function transforms the path specified by <code>$path</code> into a full operating system path.<br /> |
− | |} | + | |} |
− | + | ||
==file:path-to-uri== | ==file:path-to-uri== | ||
− | |||
{| | {| | ||
|- | |- | ||
− | | width= | + | | valign='top' width='90' | '''Signatures''' |
− | |<code><b>file:path-to-uri</b>($path as xs:string) as xs:string</code> | + | |<code><b>file:path-to-uri</b>($path as xs:string) as xs:string</code><br /> |
|- | |- | ||
− | | | + | | valign='top' | '''Summary''' |
− | | Returns | + | |Returns a URI representation. |
|- | |- | ||
− | | | + | | valign='top' | '''Rules''' |
− | | This function transforms | + | |This function transforms the path specified by <code>$path</code> into a URI with the <code>file://</code> scheme.<br /> |
|} | |} | ||
+ | |||
[[Category:XQuery]] | [[Category:XQuery]] |
Revision as of 20:57, 13 December 2010
The file module contains extension functions to perform file system related operations, such as listing, reading, or writing files. All functions are preceded by the file:
prefix. Some changes might happen to this module, as it is currently aligned with the upcoming EXPath specification.
Contents
- 1 file:exists
- 2 file:is-directory
- 3 file:is-file
- 4 file:is-readable
- 5 file:is-writable
- 6 file:last-modified
- 7 file:size
- 8 file:list
- 9 file:create-directory
- 10 file:delete
- 11 file:read
- 12 file:read-binary
- 13 file:write
- 14 file:write-binary
- 15 file:copy
- 16 file:move
- 17 file:path-separator
- 18 file:path-to-full-path
- 19 file:path-to-uri
file:exists
Signatures | file:exists($path as xs:string) as xs:boolean |
Summary | Checks if a path exist. |
Rules | This function returns an xs:boolean indicating whether a file or directory specified by $path exists in the file system. |
file:is-directory
Signatures | file:is-directory($path as xs:string) as xs:boolean |
Summary | Checks if a path points to a directory. |
Rules | This function returns an xs:boolean indicating whether the argument $path points to an existing directory. |
file:is-file
Signatures | file:is-file($path as xs:string) as xs:boolean |
Summary | Checks if a path points to a file. |
Rules | This function returns an xs:boolean indicating whether the argument $path points to an existing file. |
file:is-readable
Signatures | file:is-readable($path as xs:string) as xs:boolean |
Summary | Checks if a file is readable. |
Rules | This function returns an xs:boolean indicating whether the file specified by $path exists and is readable. |
file:is-writable
Signatures | file:is-writable($path as xs:string) as xs:boolean |
Summary | Checks if a file is writable. |
Rules | This function returns an xs:boolean indicating whether the file specified by $path exists and is writable. |
file:last-modified
Signatures | file:last-modified($path as xs:string) as xs:dateTime |
Summary | Returns the timestamp of a path. |
Rules | This function retrieves the timestamp of the last modification of the file or directory specified by $path . |
Errors | [FOFL0001] is raised if the specified path does not exist. |
file:size
Signatures | file:size($path as xs:string) as xs:integer |
Summary | Returns the size of a file. |
Rules | This function returns the size, in bytes, of the file specified by $path . The return value is unspecified if the argument points to a directory. |
Errors | [FOFL0001] is raised if the specified path does not exist. |
file:list
Signatures | file:list($path as xs:string) as xs:string* file:list($path as xs:string, $recursive as xs:boolean) as xs:string* file:list($path as xs:string, $recursive as xs:boolean, $pattern as xs:string) as xs:string* |
Summary | Lists the contents of a directory. |
Rules | This function lists all files and directories found in the directory that is specified by $path . The returned paths are relative to the provided path.The optional parameter $recursive specifies whether the sub-directories are to be recursed as well.The optional parameter $pattern defines a file name pattern. If present, only those files and directories are returned that correspond to the pattern. A pattern may contain asterisks (* ) to match zero or more characters, and question marks (? ) to match single characters. Several patterns can be separated with a comma (, ). |
Errors | [FOFL0001] is raised if the specified path does not exist. [FOFL0003] is raised if the specified path does not point to a directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:create-directory
Signatures | file:create-directory($path as xs:string) as empty-sequence() |
Summary | Creates a new directory path. |
Rules | This function recursively creates the directories specified by $path . |
Errors | [FOFL0002] is raised if a file with the same path already exists. [FOFL0006] is raised if the specified path is invalid (e.g., contains invalid characters). [FOFL0008] is raised if the operation fails for some other reason. |
file:delete
Signatures | file:delete($path as xs:string) as empty-sequence() file:delete($path as xs:string, $recursive as xs:boolean) as empty-sequence() |
Summary | Deletes a file or directory. |
Rules | This function deletes a file or directory specified by $path . No operation will be performed if the specified path does not exist.If the optional parameter $recursive is provided, the operation is performed recursively for all sub-directories of the given path. |
Errors | [FOFL0005] is raised if $recursive is not specified or set to false , and if the specified path points to a non-empty directory.[FOFL0008] is raised if the operation fails for some other reason. |
file:read
Signatures | file:read($path as xs:string) as xs:string file:read($path as xs:string, $encoding as xs:string) as xs:string |
Summary | Reads the contents a file. |
Rules | This function reads the textual contents of the file specified by $path and returns it as a xs:string .The optional parameter $encoding defines the encoding of the file. |
Errors | [FOFL0001] is raised if the specified file does not exist. [FOFL0004] is raised if the specified path is a directory. [FOFL0007] is raised if the specified encoding is not supported, or unknown. [FOFL0008] is raised if the operation fails for some other reason. |
file:read-binary
Signatures | file:read-binary($path as xs:string) as xs:base64Binary |
Summary | Reads the binary contents of a file. |
Rules | This function reads the binary content of the file specified by $path and returns as a xs:base64Binary . |
Errors | [FOFL0001] is raised if the specified file does not exist. [FOFL0004] is raised if the specified path is a directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:write
Signatures | file:write($path as xs:string, $items as xs:item()*) as empty-sequence() file:write($path as xs:string, $items as xs:item()*, $params as xs:node()*) as empty-sequence() file:write($path as xs:string, $items as xs:item()*, $params as xs:node()*, $append as xs:boolean) as empty-sequence() |
Summary | Writes a sequence of items to a file. |
Rules | This function writes a sequence, specified by $items , to a file specified by $path . If the specified file already exists, it will be overwritten.The optional argument $params is used to set the serialization parameters, as defined in XSLT 2.0 and XQuery 1.0 Serialization.If the $append flag is set to true , the serialized items are appended to the original file. If the file does not exist, a new one is created. |
Errors | [FOFL0004] is raised if the specified path is a directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:write-binary
Signatures | file:write-binary($path as xs:string, $item as xs:base64Binary) as empty-sequence() file:write-binary($path as xs:string, $item as xs:base64Binary, $append as xs:boolean) as empty-sequence() |
Summary | Writes a sequence of items to a file. |
Rules | This function writes a xs:basex64Binary item specified by $item to a file specified by $path . If the specified file already exists, it will be overwritten.If the $append flag is set to true , the serialized item is appended to the original file. If the file does not exist, a new one is created. |
Errors | [FOFL0004] is raised if the specified path is a directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:copy
Signatures | file:copy($source as xs:string, $target as xs:string) as empty-sequence() |
Summary | Copies a file. |
Rules | This function copies a file specified by $source to the file or directory specified by $target . If the target represents an existing file, it will be overwritten. No operation will be performed if the source and target path are equal. |
Errors | [FOFL0001] is raised if the specified source does not exist. [FOFL0004] is raised if the specified source is a directory. [FOFL0006] is raised if the specified target path points to a file in a non-existing directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:move
Signatures | file:move($source as xs:string, $target as xs:string) as empty-sequence() |
Summary | Moves a file. |
Rules | This function moves, or renames, the file or directory specified by $source to the path specified by $target . No operation will be performed if the source and target path are equal. |
Errors | [FOFL0001] is raised if the specified source does not exist. [FOFL0006] is raised if the specified target path points to a file in a non-existing directory. [FOFL0008] is raised if the operation fails for some other reason. |
file:path-separator
Signatures | file:path-separator() as xs:string |
Summary | Returns the path separator. |
Rules | This function returns the path separator used by the operating system. |
file:path-to-full-path
Signatures | file:path-to-full-path($path as xs:string) as xs:string |
Summary | Returns a full path representation. |
Rules | This function transforms the path specified by $path into a full operating system path. |
file:path-to-uri
Signatures | file:path-to-uri($path as xs:string) as xs:string |
Summary | Returns a URI representation. |
Rules | This function transforms the path specified by $path into a URI with the file:// scheme. |