XQuery和Zorba:从XQuery文档内部设置序列化参数 [英] XQuery and Zorba: Setting the serialization parameters from inside the XQuery document

查看:92
本文介绍了XQuery和Zorba:从XQuery文档内部设置序列化参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据此:

http://www.xmlplease.com/xquery-xhtml

"XQuery没有设置序列化参数(如果可用)的标准方法.在XQuery中,我们必须查找XQuery处理器的适当文档,以了解实现了哪些序列化参数,以及如何实现这些参数.使用它们.如果可用,通常可以在命令行中设置它们.通常,也可以在XQuery文档中使用它们."

在撒克逊人,你可以写类似的东西

In Saxon you can write something like

declare option saxon:output "omit-xml-declaration=yes";

但是在Zorba XQuery中没有提及如何实现.你能帮我吗?谢谢.

But there is no mention on how to do it in Zorba XQuery. Can you help? Thank you.

推荐答案

Zorba尚未实现XQuery 3.0 Prolog选项进行序列化.

Zorba doesn't implement the XQuery 3.0 prolog options for serialization, yet.

配置序列化程序的唯一方法是使用命令行界面(例如--omit-xml-declaration)或主机语言(例如C ++ API).

The only way to configure the serializer is using the command line interface (e.g. --omit-xml-declaration) or a host language (e.g. the C++ API).

XQuery_t lQuery = aZorba->compileQuery("for $i in (1 to 3) return <a> { $i } </a>");

Zorba_SerializerOptions lSerOptions;
lSerOptions.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;

lQuery->execute(std::cout, &lSerOptions);

或者,您可以将结果显式序列化为字符串

Alternatively, you could explicitly serialize the result to a string

fn:serialize($result,
  <output:serialization-parameters>
    <output:indent value="yes"/>
    <output:method value="xml"/>
    <output:omit-xml-declaration value="yes"/>
  </output:serialization-parameters>
)

,然后在命令行界面中使用文本序列化方法(--serialize-text)输出此字符串.

and then use the text serialization method (--serialize-text) in the command line interface to output this string.

这篇关于XQuery和Zorba:从XQuery文档内部设置序列化参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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