1

XForms を使用して「Drop a Database」というボタンを表示する単純なインターフェイスを作成しようとしています。dropdatabase.xqm次に、フォームのボタンがクリックされたときに呼び出される RestXQ ドキュメントを呼び出せるようにしたいと考えています。BaseXを使用しています。XForms をフォルダー内のファイルに保存onlydel.xmlしました。basex/webapp/staticdropdatabase.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.

私が必要とする助けは次のとおりです。

  1. 私が書いたコードでこのようなことをすることはできますか?
  2. エラーの理由とエラーを解消するための解決策も役立ちます
4

1 に答える 1

1

エラーメッセージは私には非常に明確に思えます:db:drop()は更新式であるため、現時点では許可されていません。%updating注釈を使用して、関数を更新関数としてマークする必要があります。

于 2014-04-02T17:39:45.540 に答える