xmlns 属性上的 Camel XPATH 选择包含
Camel XPATH choice on xmlns attribute contains
我想在包含值的 xml 命名空间上使用选择。
<Document xmlns="www.ddd.test.123.001">
<properties>...
</Document>
骆驼:
from("direct:in")
.choice()
.when().xpath("/Document[@xmlns, contains(., 'test.123')]")
.to("mock:pain:001")
xmlns 包含我想使用的路由值。
这可能吗?正确的骆驼 XPath 字符串是什么?
我不知道 Camel,但在 XPath 1.0 中会是
"/*[local-name() = 'Document' and contains(namespace-uri(), 'test.123')]"
您不能使用 /Document
,因为它只会匹配没有命名空间的文档元素。
我想在包含值的 xml 命名空间上使用选择。
<Document xmlns="www.ddd.test.123.001">
<properties>...
</Document>
骆驼:
from("direct:in")
.choice()
.when().xpath("/Document[@xmlns, contains(., 'test.123')]")
.to("mock:pain:001")
xmlns 包含我想使用的路由值。 这可能吗?正确的骆驼 XPath 字符串是什么?
我不知道 Camel,但在 XPath 1.0 中会是
"/*[local-name() = 'Document' and contains(namespace-uri(), 'test.123')]"
您不能使用 /Document
,因为它只会匹配没有命名空间的文档元素。