【问题标题】:How to extract attribute value in XML using xpath in mule如何使用 mule 中的 xpath 提取 XML 中的属性值
【发布时间】:2016-02-22 07:15:44
【问题描述】:

我想从我的 xml 中提取属性的值。 但结果我得到了空值。 请检查以下代码sn-p是否正确。

Mule 配置文件

<mulexml:namespace-manager includeConfigNamespaces="false">
    <mulexml:namespace prefix="argo" uri="http://www.x.com/argo/" />
</mulexml:namespace-manager>
<flow name="kFlow">
    <file:inbound-endpoint path="C:\Users\im\Desktop" responseTimeout="10000" doc:name="File" moveToDirectory="">
        <file:filename-regex-filter pattern="ACK.xml" caseSensitive="true"/>
    </file:inbound-endpoint>
    <file:file-to-string-transformer doc:name="File to String"/>
    <logger message="#[xpath('//argo:ackTransactions/argo:ackTransaction/@argo:ediAckTransactionType').text]" level="INFO" doc:name="Logger"/>

</flow>

【问题讨论】:

    标签: xpath attributes mule


    【解决方案1】:

    使用完全相同的命名空间:

    <mulexml:namespace prefix="argo" uri="http://www.navis.com/argo" />
    

    【讨论】:

    • 感谢大卫·多索。我使用了确切的名称空间及其现在的工作方式。错误地在末尾添加了一个/
    • @mule-user 请阅读meta.stackexchange.com/a/5235/232266 了解如何正确接受 StackOverflow 上的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-23
    • 1970-01-01
    • 2023-03-21
    • 2014-01-26
    • 2012-07-26
    相关资源
    最近更新 更多