Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XPath(SOAP UI):检查是否定义了特定的命名空间URI_Xpath_Soapui - Fatal编程技术网

XPath(SOAP UI):检查是否定义了特定的命名空间URI

XPath(SOAP UI):检查是否定义了特定的命名空间URI,xpath,soapui,Xpath,Soapui,我正在尝试使用XPath匹配断言为SOAP UI中的测试步骤编写断言我想检查REST服务的响应中是否定义了特定的命名空间URI我正在尝试将范围内前缀和命名空间uri组合用于前缀函数,但我无法使其正常工作,因此可能有人有建议 in-scope-prefixes(/other:element) 给我一个包含所有已定义前提的集合,我无法用 string-join(in-scope-prefixes(/other:element), ',') 因此,在第一步中,我想选择我正在查找的名称空间URI的前

我正在尝试使用XPath匹配断言为SOAP UI中的测试步骤编写断言
我想检查REST服务的响应中是否定义了特定的命名空间URI
我正在尝试将
范围内前缀
命名空间uri组合用于前缀
函数,但我无法使其正常工作,因此可能有人有建议

in-scope-prefixes(/other:element)
给我一个包含所有已定义前提的集合,我无法用

string-join(in-scope-prefixes(/other:element), ',')
因此,在第一步中,我想选择我正在查找的名称空间URI的前缀

in-scope-prefixes(/other:element)[namespace-uri-for-prefix(.,/my:rootElement)='http://namespaceuri.org/my']
但是soapui给了我一个错误

无效的XPath表达式

现在我想知道这个表达是否真的无效?差不多

in-scope-prefixes(/other:element)[concat(.,'-') = 'my-']
工作时不会出现错误。
我是否遗漏了什么

EDIT1
我刚刚意识到我能够通过使用XQuery实现我想要的

但这是行不通的:

declare namespace other='http://namespaceuri.org/other';
let $ret := exists(in-scope-prefixes(/other:rootElement)[namespace-uri-for-prefix(.,/other:rootElement)='http://namespaceuri.org/my'])
return $ret
对于后者,soapui给出了一个例外

无效的XQuery表达式

除了我可以在XQuery中使用变量之外,它的行为似乎与XPath相同。
这对任何人都有意义吗?你知道如何使用XPath实现吗

declare namespace other='http://namespaceuri.org/other';
let $ret := exists(in-scope-prefixes(/other:rootElement)[namespace-uri-for-prefix(.,/other:rootElement)='http://namespaceuri.org/my'])
return $ret