英文:
How to configure Woodstox properties in using Apache Camel?
问题
根据woodstox的GitHub页面 https://github.com/FasterXML/woodstox/issues/59
可以通过XMLInputFactory配置Woodstox属性。
我现在正在使用带有JAVA DSL的Camel,它使用woodstox-core处理XML
https://camel.apache.org/components/next/eips/split-eip.html#_streaming_big_xml_payloads_using_xml_tokenize_language
我想配置Woodstox属性,例如 WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE
如何在Apache Camel中配置Woodstox属性?
(Java 8,Apache Camel 2.25.4)
参考代码:
camel:
Exchange in = camelContext.getEndpoint("direct:xxx").createExchange();
in.getIn().setBody(xmlContent);
ProducerTemplate template = camelContext.createProducerTemplate();
Exchange out = template.send("direct:xxx", in);
---
route builder:
from("direct:xxx")
.routeId("xxx")
.split(body().xtokenize("//xxx:xxx", 'i', ns), myAggregationStrategy)
.process(myProcessor)
.end();
英文:
According to woodstox github https://github.com/FasterXML/woodstox/issues/59
Woodstox properties can be configured through XMLInputFactory.
I'm now using camel with JAVA DSL, which use woodstox-core for XML
https://camel.apache.org/components/next/eips/split-eip.html#_streaming_big_xml_payloads_using_xml_tokenize_language
I want to configure Woodstox property e.g. WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE
How can I configure Woodstox properties in using Apache Camel?
(Java 8, Apache Camel 2.25.4)
Code for reference:
camel:
Exchange in = camelContext.getEndpoint("direct:xxx").createExchange();
in.getIn().setBody(xmlContent);
ProducerTemplate template = camelContext.createProducerTemplate();
Exchange out = template.send("direct:xxx", in);
---
route builder:
from("direct:xxx")
.routeId("xxx")
.split(body().xtokenize("//xxx:xxx", 'i', ns), myAggregationStrategy)
.process(myProcessor)
.end();
答案1
得分: 0
我已将此错误报告给Apache。由于camel 2.25.4已经到了生命周期结束(EOL)阶段,它将在新版本的camel-stax中修复。
修复版本:
3.14.9, 3.18.8, 3.20.6, 3.21.0, 4.0-RC1, 4.0
如果无法升级camel版本,可以考虑在所有xml标签上添加自定义命名空间来避免此问题,而不是使用xml默认命名空间,例如:
<ns1:XX ... xmlns:ns1="XXXX">
<ns1:YY>zzz</ns1:YY>
</ns1:XX>
英文:
I've reported this bug to Apache. As camel 2.25.4 is already EOL, it will be fixed at new version of camel-stax.
Fix Version/s:
3.14.9, 3.18.8, 3.20.6, 3.21.0, 4.0-RC1, 4.0
https://issues.apache.org/jira/browse/CAMEL-19415
If it is not possible to upgrade the camel version, instead of using xml default namespace, adding a custom namespace on all xml tag should be a possible way to avoid this issue. i.e.
<ns1:XX ... xmlns:ns1="XXXX">
<ns1:YY>zzz</ns1:YY>
</ns1:XX>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论