如何使用Apache Camel配置Woodstox属性?

dly7yett  于 2023-06-22  发布在  Apache
关注(0)|答案(1)|浏览(117)

关于woodstox github https://github.com/FasterXML/woodstox/issues/59
Woodstox属性可以通过XMLInputFactory进行配置。
我现在使用的是camel和JAVA DSL,后者使用woodstox-core作为XMLhttps://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();
unguejic

unguejic1#

我已经向Apache报告了这个bug。由于camel 2.25.4已经下线,因此将在camel-stax的新版本中修复。
修复版本: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
如果不可能升级CAMEL版本,那么不使用XML默认名称空间,在所有XML标记上添加自定义名称空间应该是避免此问题的一种可能方法。即

<ns1:XX ... xmlns:ns1="XXXX">
    <ns1:YY>zzz</ns1:YY>
</ns1:XX>

相关问题