XForms を使用して「Drop a Database」というボタンを表示する単純なインターフェイスを作成しようとしています。dropdatabase.xqm
次に、フォームのボタンがクリックされたときに呼び出される RestXQ ドキュメントを呼び出せるようにしたいと考えています。BaseXを使用しています。XForms をフォルダー内のファイルに保存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.
私が必要とする助けは次のとおりです。
- 私が書いたコードでこのようなことをすることはできますか?
- エラーの理由とエラーを解消するための解決策も役立ちます