将输出从exists-db打印到文件

时间:2013-04-11 09:24:23

标签: xquery exist-db

我在exists-db上执行了一个xquery。现在我想在csv或excel文件这样的文件中打印输出,怎么做呢。

我可以用HTML格式打印输出,但有没有办法生成相同的文件。

1 个答案:

答案 0 :(得分:1)

使用FileModule,它具有serialize功能:

file:serialize
file:serialize($node-set as node()*, $path as item(), $parameters as xs:string*, 
$append as xs:boolean) as xs:boolean?

Writes the node set into a file on the file system, optionally appending to it. $parameters contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. This method is only available to the DBA role.

Parameters:
    $node-set*  The contents to write to the file system.
    $path   The full path or URI to the file
    $parameters*    The serialization parameters specified as key-value pairs
    $append     Should content be appended?
Returns:
    xs:boolean? : true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.

<强>参考