创建集合,使用命令行将文档添加到 zorba? [英] create collection, add document to zorba using command line?

查看:42
本文介绍了创建集合,使用命令行将文档添加到 zorba?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用命令行界面在全新的 zorba 安装中创建一个集合并将文档添加到该集合中 http://www.zorba-xquery.com/html/documentation/2.7.0/zorba/commandline

I am wondering how one creates a collection and adds a document to that collection in a fresh zorba install using the commandline interface http://www.zorba-xquery.com/html/documentation/2.7.0/zorba/commandline

如果不能通过命令行完成,使用脚本 api 的示例会很好.

If it cannot be done with the command line an example using the scripting api would be good.

推荐答案

这可以使用 XQuery 脚本来完成.考虑以下 XQuery 模块:

This can be done using XQuery scripting. Consider the following XQuery module:

module namespace news-data = "http://www.news.org/data";

declare namespace an = "http://www.zorba-xquery.com/annotations";

declare collection news-data:employees as element(employee)*;
declare variable $news-data:employees := xs:QName('news-data:employees');

你可以这样使用它:

import module namespace news-data = "http://www.news.org/data" at "news-data.xq";

import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";

ddl:create($news-data:employees);
dml:insert-nodes($news-data:employees, doc("test2.xml"));

这篇关于创建集合,使用命令行将文档添加到 zorba?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆