簡體   English   中英

XForms和restxq應用程序

[英]XForms and restxq application

我正在嘗試創建一個簡單的界面,該界面將使用XForms顯示“ Drop a Database”按鈕。 然后,我希望能夠調用一個名為dropdatabase.xqm的RestXQ文檔,該文檔在單擊表單上的按鈕時被調用。 我正在使用BaseX。 我將XForm保存在basex/webapp/static文件夾中名為onlydel.xml的文件中。 我創建了名為dropdatabase.xqm的RestXQ程序,並將其保存到我的basex/webapp文件夾中。 我創建了一個名為數據庫patients

xformsonlydel.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. 錯誤的原因是什么,消除該錯誤的解決方案也將有所幫助

錯誤消息對我來說似乎很清楚: db:drop()是一個更新表達式,因此在這一點上是不允許的。 您必須使用%updating批注將功能標記為更新功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM