2013-06-26 43 views
0

我對XQuery比較陌生。但是,我對我的問題做了大量的研究,不明白我做錯了什麼。這裏是我的代碼:未找到模式/模塊的目標名稱空間

(: XQuery main module :) 
xquery version "3.0" encoding "utf-8"; 

import schema namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; 
import module namespace http = "http://expath.org/ns/http-client"; 
import module namespace rand = "http://www.zorba-xquery.com/modules/random"; 

declare variable $URL as xs:string :=(); 
declare variable $AF_Tok as xs:integer := rand:seeded-random-between(23 (:This is the seed, needs to be randomized too, will fix later.:), 
                   0 (:This is the lower bound for every number in the sequence.:), 
                   9 (:This is the higher bound for every number in the sequence.:), 
                   32 (:This is the number of random numbers in the returned sequence:) 
                   ); 
declare variable $Client_ID as xs:string := ("XXXXX"); 
declare variable $Client_Secret as xs:string := ("XXXXX"); 

<test> 
    <random_number>{$AF_Tok}</random_number> 
</test> 

我在eXist和Sausalito Tools for Eclipse中都得到相同的錯誤。任何人都可以測試一下,讓我知道如果你也得到錯誤?我很難過,任何幫助將不勝感激。

:6,1:靜態錯誤[ERR:XQST0059]:「http://www.zorba-xquery.com/modules/random」:目標命名空間中找不到的模式/模塊http://www.zorba-xquery.com/modules/random

我認爲這可能是一個左巴的問題,但我得到了同樣的錯誤w3和expath命名空間也是如此。

更新:我使用的是Mac OS X 10.8 BTW

回答

0

你不能簡單地使用與存在的左巴模塊。我也不認爲eXist支持HTTP客戶端的EXPath模塊。看看你的處理器(eXist或Sausalito)的文檔,只使用他們支持的模塊。如果它們是內置的,則使用簡單的import module namespace應該足夠,但是,如果要包含通用模塊,則還必須在某個與處理器相關的目錄中提供模塊源。

對於eXist,請查看http://exist-db.org/exist/apps/doc/extensions.xml以瞭解如何包含模塊。 eXist也具有隨機函數,但是它們是在數學模塊中構建的。

+0

@dirrk我實際上通過將命令更改爲'import module namespace rand = http://www.zorba-xquery.com/modules/random <命名空間的位置>來解決錯誤;' – zg303

相關問題