Difference between revisions of "File Module"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | <p>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 | + | <p>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.</p> |
− | ==file:exists== | + | ==file:exists== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:exists</b>($path as xs:string) as xs:boolean</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Checks if a path exist. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function checks if a path is already used in the file system. The function returns <code>true</code> if the file or directory pointed by the <code>$path</code> parameter already exists. Otherwise it returns <code>false</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:is-directory== | + | ==file:is-directory== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:is-directory</b>($path as xs:string) as xs:boolean</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Checks if a path points to a directory. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function checks if a path points to a directory. The function returns <code>true</code> if the path points to a directory. Otherwise, it returns <code>false</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:is-file== | + | ==file:is-file== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:is-file</b>($path as xs:string) as xs:boolean</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Checks if a path points to a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function checks if a path points to a file. The function returns <code>true</code> if the path points to a file. Otherwise, it returns <code>false</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:is-readable== | + | ==file:is-readable== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:is-readable</b>($path as xs:string) as xs:boolean</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Checks if a file is readable. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function checks if the file pointed by <code>$path</code> is readable. The function returns <code>true</code> if the file is readable. Otherwise it returns <code>false</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:is-writable== | + | ==file:is-writable== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:is-writable</b>($path as xs:string) as xs:boolean</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Checks if a file is writeable. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function checks if the file pointed by <code>$path</code> is writeable. The function returns <code>true</code> if the file is writeable. Otherwise it returns <code>false</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:last-modified== | + | ==file:last-modified== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:last-modified</b>($path as xs:string) as xs:dateTime</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Returns the timestamp of a path. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function retrieves the timestamp of the last modification of the item pointed by the path provided by the parameter<code>$path</code>.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:files== | + | ==file:files== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:files</b>($path as xs:string) as xs:string*</code> <br /> <code><b>file:files</b>($path as xs:string, $recursive as xs:boolean) as xs:string*</code> <br /> <code><b>file:files</b>($path as xs:string, $recursive as xs:boolean, $pattern as xs:string) as xs:string*</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Lists files of a directory. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function lists all files in a given directory. The special files "." and ".." are never returned.<br />The optional parameter <code>$recursive</code> indicates whether the search shall recurse in the subdirectories.<br />The optional parameter <code>$pattern</code> defines a pattern and if it is present, only the files, which names match the given pattern, will be returned.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0003]</b> is raised if files in the given directory cannot be returned.<br /> <b>[FOFL0004]</b> is raised for an invalid file pattern.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:read== | + | ==file:read== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:read</b>($path as xs:string) as xs:string</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Reads a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function reads the content of the file pointed by <code>$path</code> and returns it as a string.<br />The optional parameter <code>$encoding</code> defines the encoding type of the file.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0017]</b> is raised if the provided encoding is not supported.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:read-binary== | + | ==file:read-binary== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:read-binary</b>($path as xs:string) as xs:base64Binary</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Reads a binary file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function reads the content of the file pointed by <code>$path</code> and returns it in Base64 representation.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0001]</b> is raised if the file cannot be read.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:size== | + | ==file:size== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:size</b>($path as xs:string) as xs:integer</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Returns the file size. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function returns the size, in bytes, of the file pointed by <code>$path</code>.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0001]</b> is raised if the file cannot be read.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | ==file:write== | + | ==file:write== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<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> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Writes a sequence of items to a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function writes a sequence of <code>items</code> to a file. It either creates a new file, or appends the serialized content to the file pointed by <code>$path</code>.<br />The <code>$params</code> parameter 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 true and the file does not exist, a new one is created.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0002]</b> is raised if the file cannot be written.<br /><b>[FOFL0008]</b> is raised if the <code>$append</code> flag is <code>false</code> and a file with the same path already exists.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:write-binary== | + | ==file:write-binary== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:write-binary</b>($path as xs:string, $items as xs:base64Binary) as empty-sequence()</code> <br /><code><b>file:write-binary</b>($path as xs:string, $items as xs:base64Binary, $append as xs:boolean) as empty-sequence()</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Writes a sequence of items to a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function writes binary data into a file. It either creates a new file or appends the content to the file pointed by <code>$path</code>.<br />If the <code>$append</code> flag is true and the file does not exist, a new one is created.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0002]</b> is raised if the file cannot be written.<br /><b>[FOFL0008]</b> is raised if the <code>$append</code> flag is <code>false</code> and a file with the same path already exists.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:mkdir== | + | ==file:mkdir== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:mkdir</b>($path as xs:string, $recursive as xs:boolean) as empty-sequence()</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Creates a new directory. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function creates a directory.<br />The optional parameter <code>$recursive</code> indicates whether parent directories are to be created recursively.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0008]</b> is raised if a file with the same path already exists in the file system.<br /><b>[FOFL0011]</b> is raised if the directory in which the new sub-directory is to be created is write protected.<br /> <b>[FOFL0012]</b> is raised if the directory cannot be created for some other reason.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:delete== | + | ==file:delete== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:delete</b>($path as xs:string) as empty-sequence()</code><br /><b>file:delete</b>($path as xs:string, $recursive as xs:boolean) as empty-sequence()</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Deletes a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function deletes a file or directory from the file system.<br />If the optional parameter <code>$recursive</code> is provided, the operation is performed recursively for all sub-directories of the given directory.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0005]</b> is raised if the file/directory pointed by <code>$path</code> is write-protected and cannot be deleted.<br /> <b>[FOFL0006]</b> is raised if the file/directory pointed by <code>$path</code> does not exist.<br /> <b>[FOFL0013]</b> is raised if the file/directory pointed by <code>$path</code> cannot be deleted for some other reason.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:copy== | + | ==file:copy== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:copy</b>($source as xs:string, $target as xs:string) as empty-sequence()</code><br /><b>file:copy</b>($source as xs:string, $target as xs:string, $overwrite as xs:boolean) as empty-sequence()</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Copies a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function copies a file specified by <code>$source</code> to <code>$target</code>.<br />If the optional parameter <code>$overwrite</code> is provided and evaluates to <code>true</code>, the target file, if it exists, will be overwritten.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0006]</b> is raised if the file pointed by <code>$source</code> does not exist.<br /> <b>[FOFL0008]</b> is raised if the file to be copied already exists in the specified target and the <code>$overwrite</code> parameter is missing or evaluates to <code>false<code>.<br /> <b>[FOFL0016]</b> is raised if the source file cannot be copied because of some other reason.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:move== | + | ==file:move== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:move</b>($source as xs:string, $target as xs:string) as empty-sequence()</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Moves a file. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function moves/renames the file pointed by <code>$source</code> to <code>$target</code>.<br /> | |
− | + | |- | |
− | + | | <b>Errors</b> | |
− | + | | <b>[FOFL0006]</b> is raised if the file pointed by <code>$source</code> does not exist.<br /> <b>[FOFL0008]</b> is raised if a file/directory with the same name already exists in the given target.<br /> <b>[FOFL0009]</b> is raised if the item pointed by <code>$source</code> is a directory.<br /> <b>[FOFL0010]</b> is raised if the file pointed by <code>$source</code> is write-protected and cannot be moved.<br /> <b>[FOFL0014]</b> is raised if the file cannot be moved for some other reason.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:path-separator== | + | ==file:path-separator== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:path-separator</b>() as xs:string</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Returns the path separator. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function returns the path separator used by the operating system.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:path-to-full-path== | + | ==file:path-to-full-path== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:path-to-full-path</b>($path as xs:string) as xs:string</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | Returns a full path representation. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function transforms a path into a full operating system path.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==file:path-to-uri== | + | ==file:path-to-uri== |
− | + | ||
− | + | {| | |
− | + | |- | |
− | + | | width="90" | <b>Signatures</b> | |
− | + | |<code><b>file:path-to-uri</b>($path as xs:string) as xs:string</code> | |
− | + | |- | |
− | + | | <b>Summary</b> | |
− | + | | >Returns a URI representation. | |
− | + | |- | |
− | + | | <b>Rules</b> | |
− | + | | This function transforms a file system path into a URI with the file:// scheme.<br /> | |
− | + | |} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:XQuery]] | [[Category:XQuery]] | ||
− |
Revision as of 17:03, 12 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:files
- 8 file:read
- 9 file:read-binary
- 10 file:size
- 11 file:write
- 12 file:write-binary
- 13 file:mkdir
- 14 file:delete
- 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 checks if a path is already used in the file system. The function returns true if the file or directory pointed by the $path parameter already exists. Otherwise it returns false . |
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 checks if a path points to a directory. The function returns true if the path points to a directory. Otherwise, it returns false . |
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 checks if a path points to a file. The function returns true if the path points to a file. Otherwise, it returns false . |
file:is-readable
Signatures | file:is-readable($path as xs:string) as xs:boolean
|
Summary | Checks if a file is readable. |
Rules | This function checks if the file pointed by $path is readable. The function returns true if the file is readable. Otherwise it returns false . |
file:is-writable
Signatures | file:is-writable($path as xs:string) as xs:boolean
|
Summary | Checks if a file is writeable. |
Rules | This function checks if the file pointed by $path is writeable. The function returns true if the file is writeable. Otherwise it returns false . |
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 item pointed by the path provided by the parameter$path . |
file:files
Signatures | file:files($path as xs:string) as xs:string* file:files($path as xs:string, $recursive as xs:boolean) as xs:string* file:files($path as xs:string, $recursive as xs:boolean, $pattern as xs:string) as xs:string*
|
Summary | Lists files of a directory. |
Rules | This function lists all files in a given directory. The special files "." and ".." are never returned. The optional parameter $recursive indicates whether the search shall recurse in the subdirectories.The optional parameter $pattern defines a pattern and if it is present, only the files, which names match the given pattern, will be returned. |
Errors | [FOFL0003] is raised if files in the given directory cannot be returned. [FOFL0004] is raised for an invalid file pattern. |
file:read
Signatures | file:read($path as xs:string) as xs:string
|
Summary | Reads a file. |
Rules | This function reads the content of the file pointed by $path and returns it as a string.The optional parameter $encoding defines the encoding type of the file. |
Errors | [FOFL0017] is raised if the provided encoding is not supported. |
file:read-binary
Signatures | file:read-binary($path as xs:string) as xs:base64Binary
|
Summary | Reads a binary file. |
Rules | This function reads the content of the file pointed by $path and returns it in Base64 representation. |
Errors | [FOFL0001] is raised if the file cannot be read. |
file:size
Signatures | file:size($path as xs:string) as xs:integer
|
Summary | Returns the file size. |
Rules | This function returns the size, in bytes, of the file pointed by $path . |
Errors | [FOFL0001] is raised if the file cannot be read. |
file:write
Signatures | 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 of items to a file. It either creates a new file, or appends the serialized content to the file pointed by $path .The $params parameter is used to set the serialization parameters as defined in XSLT 2.0 and XQuery 1.0 Serialization.If the $append flag is true and the file does not exist, a new one is created. |
Errors | [FOFL0002] is raised if the file cannot be written. [FOFL0008] is raised if the $append flag is false and a file with the same path already exists. |
file:write-binary
Signatures | file:write-binary($path as xs:string, $items as xs:base64Binary) as empty-sequence() file:write-binary($path as xs:string, $items as xs:base64Binary, $append as xs:boolean) as empty-sequence()
|
Summary | Writes a sequence of items to a file. |
Rules | This function writes binary data into a file. It either creates a new file or appends the content to the file pointed by $path .If the $append flag is true and the file does not exist, a new one is created. |
Errors | [FOFL0002] is raised if the file cannot be written. [FOFL0008] is raised if the $append flag is false and a file with the same path already exists. |
file:mkdir
Signatures | file:mkdir($path as xs:string, $recursive as xs:boolean) as empty-sequence()
|
Summary | Creates a new directory. |
Rules | This function creates a directory. The optional parameter $recursive indicates whether parent directories are to be created recursively. |
Errors | [FOFL0008] is raised if a file with the same path already exists in the file system. [FOFL0011] is raised if the directory in which the new sub-directory is to be created is write protected. [FOFL0012] is raised if the directory cannot be created 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. |
Rules | This function deletes a file or directory from the file system. If the optional parameter $recursive is provided, the operation is performed recursively for all sub-directories of the given directory. |
Errors | [FOFL0005] is raised if the file/directory pointed by $path is write-protected and cannot be deleted.[FOFL0006] is raised if the file/directory pointed by $path does not exist.[FOFL0013] is raised if the file/directory pointed by $path cannot be deleted for some other reason. |
file:copy
Signatures | file:copy($source as xs:string, $target as xs:string) as empty-sequence() file:copy($source as xs:string, $target as xs:string, $overwrite as xs:boolean) as empty-sequence() |
Summary | Copies a file. |
Rules | This function copies a file specified by $source to $target .If the optional parameter $overwrite is provided and evaluates to true , the target file, if it exists, will be overwritten. |
Errors | [FOFL0006] is raised if the file pointed by $source does not exist.[FOFL0008] is raised if the file to be copied already exists in the specified target and the $overwrite parameter is missing or evaluates to false |
file:move
Signatures | file:move($source as xs:string, $target as xs:string) as empty-sequence()
|
Summary | Moves a file. |
Rules | This function moves/renames the file pointed by $source to $target . |
Errors | [FOFL0006] is raised if the file pointed by $source does not exist.[FOFL0008] is raised if a file/directory with the same name already exists in the given target. [FOFL0009] is raised if the item pointed by $source is a directory.[FOFL0010] is raised if the file pointed by $source is write-protected and cannot be moved.[FOFL0014] is raised if the file cannot be moved 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 a 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 a file system path into a URI with the file:// scheme. |