【发布时间】:2014-05-14 03:20:00
【问题描述】:
我正在尝试创建一个简单的界面,它将使用 XForms 显示一个按钮,上面写着“删除数据库”。然后我希望能够调用名为dropdatabase.xqm 的RestXQ 文档,当单击表单上的按钮时调用该文档。我正在使用 BaseX。我将 XForm 保存在一个名为 onlydel.xml 的文件中,该文件位于 basex/webapp/static 文件夹中。我创建了名为 dropdatabase.xqm 的 RestXQ 程序并将其保存到我的 basex/webapp 文件夹中。我创建了一个名为 patients 的数据库。
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: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"))
};
当我运行它时,我收到以下错误:
Stopped at /home/ubuntu/basex/webapp/dropdatabase.xqm, 10/13:
[XUST0001] StaticFunc expression: no updating expression allowed.
我需要的帮助是:
- 我可以用我写的代码做这样的事情吗?
- 错误的原因是什么以及消除错误的解决方案也会有所帮助
【问题讨论】:
标签: rest xforms basex xsltforms