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.
我该如何处理此错误,以配合我预期的结果?