0
我有以下情形:XQuery的錯誤處理
XQUERY:
declare namespace xs = "http://www.w3.org/2001/XMLSchema";
declare variable $udgHeader external;
let $msg-name := upper-case($udgHeader/msg-name/text())
let $recipient := upper-case($udgHeader/recipient/text())
return
<recipients>
<recipient>
<dest>
{
if (($msg-name = "ARS_ISTP") and ($recipient = "ISTP")) then
'IstpArs'
else if (($msg-name = "ARS_ESM") and ($recipient = "ESM")) then
'EsmArs'
else
error(xs:QName('fase'), concat("Unknown msg-name/recipient combination ['", $msg-name,"'/'", $recipient, "']! Please check fase recipient list."))
}
</dest>
</recipient>
</recipients>
我進來的XML將拋出錯誤。
此錯誤我想用Java(負測試)與文件(預期結果)進行比較。
預期結果內容:
Unknown msg-name/recipient combination ['ARS_XYZ'/'ARS']! Please check fase recipient list.
我的問題是,我得到這個錯誤:
org.apache.xmlbeans.XmlRuntimeException: weblogic.xml.query.exceptions.XQueryUserException: line 29, column 5: fase: Unknown msg-name/recipient combination ['ARS_XYZ'/'ESM']! Please check fase recipient list.
我該如何處理此錯誤,以配合我預期的結果?