create collection, add document to zorba using command line?

巧了我就是萌 提交于 2019-12-11 18:15:07

问题


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

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


回答1:


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');

You can use it like this:

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"));


来源:https://stackoverflow.com/questions/13026559/create-collection-add-document-to-zorba-using-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!