[英]XForms and restxq application
I am trying to create a simple interface, that will use XForms to display a button that say "Drop a Database". 我正在尝试创建一个简单的界面,该界面将使用XForms显示“ Drop a Database”按钮。 I then want to be able to invoke a RestXQ document called
dropdatabase.xqm
which is called when the button on the form is clicked. 然后,我希望能够调用一个名为
dropdatabase.xqm
的RestXQ文档,该文档在单击表单上的按钮时被调用。 I am using BaseX. 我正在使用BaseX。 I saved my XForm in a file called
onlydel.xml
in the basex/webapp/static
folder. 我将XForm保存在
basex/webapp/static
文件夹中名为onlydel.xml
的文件中。 I created my RestXQ program called dropdatabase.xqm and saved it to my basex/webapp
folder. 我创建了名为dropdatabase.xqm的RestXQ程序,并将其保存到我的
basex/webapp
文件夹中。 I have created a database called patients
. 我创建了一个名为数据库
patients
。
xforms : The contents of onlydel.xml
is: xforms :
onlydel.xml
的内容是:
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="yes"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<head>
<title>XFORMS IN XHTML</title>
<model xmlns="http://www.w3.org/2002/xforms" id="order-model">
<instance>
<soap xmlns="">
</soap>
</instance>
<submission action="/dropdatabase" method="post" id="s06"/>
</model>
</head>
<body>
<h2>DATABASE</h2>
<div style="float:center;">
<fieldset style="width:50%">
<xf:submit submission="s06"><xf:label>Drop A Database</xf:label></xf:submit>
</fieldset></div>
</body>
</html>
RestXQ :The contents of dropdatabase.xqm
is: RestXQ:的内容
dropdatabase.xqm
是:
module namespace _ = 'http://exquery.org/ns/restxq';
(:~
: Deletes the blog database and redirects the user to the main page.
:)
declare
%restxq:path("/dropdatabase")
%restxq:GET
function _:dropdatabase()
{
(db:drop("patients"))
};
When I run this I get the following error: 运行此命令时,出现以下错误:
Stopped at /home/ubuntu/basex/webapp/dropdatabase.xqm, 10/13:
[XUST0001] StaticFunc expression: no updating expression allowed.
The help I need is: 我需要的帮助是:
The error message seems quite clear to me: db:drop()
is an updating expression and is hence not allowed at this point. 错误消息对我来说似乎很清楚:
db:drop()
是一个更新表达式,因此在这一点上是不允许的。 You have to mark the function as an updating function by using the %updating
annotation. 您必须使用
%updating
批注将功能标记为更新功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.