Xml 如何从Flower for XQuery中的上下文打开BaseX数据库?

Xml 如何从Flower for XQuery中的上下文打开BaseX数据库?,xml,xpath,xml-parsing,xquery,basex,Xml,Xpath,Xml Parsing,Xquery,Basex,如何将上下文设置为特定数据库,然后在Flower中引用该数据库 PS C:\Users\thufir\Desktop\basex> PS C:\Users\thufir\Desktop\basex> PS C:\Users\thufir\Desktop\basex> basex .\openDB.xq <book category="web"> <title lang="en">XQuery Kick Start</title> &l

如何将上下文设置为特定数据库,然后在Flower中引用该数据库

PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> basex .\openDB.xq
<book category="web">
  <title lang="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>
  <year>2003</year>
  <price>49.99</price>
</book>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> type .\openDB.xq
let $db := db:open("books")
for $item in $db
return $item/bookstore/book[3]
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> basex db.xq
Stopped at C:/Users/thufir/Desktop/basex/db.xq, 1/21:
[XPST0003] Expecting ':=', found 's'.
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex> type .\db.xq
declare context items := db:open("books")

for $ctx in .

return $ctx

PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>
PS C:\Users\thufir\Desktop\basex>basex。\openDB.xq
XQuery启动

我想这样指定数据库:


但是显式地在XQuery本身的上下文中。

是不是
声明上下文项:=db:open(“books”)
只是一个输入错误,而您想要
声明上下文项:=db:open(“books”)
?这就是我解释您收到的错误消息的方式,语法是错误的(
items
,而不是
item
)。天哪,让我们假设这从未发生过(如果是这样的话)。