gpt4 book ai didi

xpath - 我如何将字符串从xpath放入richler URL

转载 作者:行者123 更新时间:2023-12-03 17:36:39 24 4
gpt4 key购买 nike

我需要一个到Enricher的GET参数。我想从带有xpath的消息正文中获取此参数。但是它不想工作。我怎么了

.enrich("localhost/getArticle.php?ArticleNumber="+xpath("//POSITION/ARTICLENUMMER[@TYPE='IN']/text()"), new addArticleStrategy())


但是被调用的URL是:

http://localhost/getArticle.php?ArticleNumber=XPath%3A+%2F%2FPOSITION%2FARTICLENUMMER%5B%40TYPE%3D%27IN%27%5D%2Ftext%28%29


如何从xpath而不是xpath字符串中获取值?

谢谢

更新:

全路线:

from("activemq:in")
.enrich("localhost/getArticle.php?ArticleNumber="+xpath("//POSITION/ARTICLENUMMER[@TYPE='IN']/text()"), new addArticleStrategy())
.to("file://C:/temp/")


更新2:
我尝试与评估:

from("activemq:in")
.enrich("localhost/getArticle.php?ArticleNumber="+xpath("//POSITION/ARTICLENUMMER[@TYPE='IN']/text()").evaluate(getContext(), body().convertToString()), new addArticleStrategy())
.to("file://C:/temp/")


但是我得到了错误:

No type converter available to convert from type: org.apache.camel.builder.ValueBuilder to the required type: org.w3c.dom.Document with value body

最佳答案

您不能将动态网址与扩展一起使用。尝试改用recipientList

编辑:

我没有尝试过(很可能打错了),但它看起来应该像这样

XPathBuilder articlexpath=xpath("//POSITION/ARTICLENUMMER[@TYPE='IN']/text()").resultType(String.class);

from("activemq:in")
.enrich("direct:getArticle", new addArticleStrategy())
.to("file://C:/temp/");

from("direct:getArticle")
.setHeader("ArticleNumber", articlexpath)
.recipientList(simple("localhost/getArticle.php?ArticleNumber=${header.ArticleNumber}"));

关于xpath - 我如何将字符串从xpath放入richler URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28043060/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com