【问题标题】:Mule ESB: xml to maps transformer produces empty hashmapsMule ESB:xml to maps 转换器产生空的哈希图
【发布时间】:2013-09-18 00:25:43
【问题描述】:

我的流程的配置是:

<flow name="addVendors" doc:name="addVendors">
        <file:inbound-endpoint path="/ws/esb/vendors/input/" moveToDirectory="/ws/esb/vendors/processed/" responseTimeout="10000" doc:name="File"/>
        <file:file-to-string-transformer mimeType="text/xml" doc:name="File to String"/>
        <jdbc-ee:xml-to-maps-transformer encoding="UTF-8" mimeType="text/xml" doc:name="XML to Maps"/>
        <component class="com.myapp.integration.VendorsHelper" doc:name="Java"/>
        <file:outbound-endpoint path="/ws/esb/vendors/output" responseTimeout="10000" doc:name="File"/>
    </flow>

我正在尝试发送以下 xml:

<?xml version="1.0"?>
<book>
        <note id="1">
            note1
            <to>Tove</to>
            <from>Jani</from>
            <heading>Reminder</heading>
            <body>Don't forget me this weekend!</body>
            <author>Some author</author>
        </note>
        <note id="2">
            note2
            <to>Mark</to>
            <from>Smith</from>
            <heading>Invitation</heading>
            <body>Invitation for birthday!</body>
            <author>Some author</author>
        </note>
</book>

问题是我在 xml-to-maps 转换后得到了两个空的 hashmap。我的代码中有什么不正确的地方?怎么调试?

【问题讨论】:

    标签: java xml mule transformation esb


    【解决方案1】:

    documentation of the transformer 中所述,xml-to-maps 转换器转换的 XML 必须符合特定架构(在文档中提供)。

    下面是一个有效的 XML 文档示例:

    <table>
      <record>
        <field name="id" type="java.math.BigDecimal">0</field>
        <field name="name" type="java.lang.String">hello</field>
      </record>
    </table>
    

    所以您需要使用 XSL-T 转换器将您的 XML 转换为预期的 XML 格式,然后您才能使用转换器。

    【讨论】:

    • 是的,这些是 JDBC 使用的一些数据类型
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 2013-02-04
    • 1970-01-01
    • 2013-03-31
    • 2018-02-05
    • 2014-12-23
    相关资源
    最近更新 更多