【发布时间】:2021-03-09 01:43:04
【问题描述】:
我每天通过电子邮件收到一个 XML 文件,我正在尝试编写一个 Flow / Power Automate 来解析 XML,从中获取 3 个变量,并将这些变量附加到 Excel 中的表格中。 XML 文件具有以下结构,它使用标识符 InputXML 加载到查询中
<?xml version="1.0" encoding="UTF-8"?>
<ifir:inter_fund_investor_report ifir:creation_date_time="2021-02-24T21:16:01"
ifir:report_id="102068045"
xmlns:ifir="nzl:org:fsc:XMLSchema:InterfundInvestorReport:v2.0">
<investor ifir:investor_name="client name" ifir:investor_id="client123">
<fund ifir:currency="USD" ifir:fund_valuation_date="2021-02-23" ifir:fund_name="Fund Name" ifir:fund_id="fundcode" ifir:is_fund_a_PIE="Y">
<balances>
<investor_units_held>123456</investor_units_held>
<total_units_on_issue>999999999</total_units_on_issue>
</balances>
<prices>
<base_price>1.060</base_price>
<entry_price>1.0650</entry_price>
<exit_price>1.055</exit_price>
</prices>
<totals ifir:fund_allocation_date="2021-02-23"/>
</fund>
</investor>
</ifir:inter_fund_investor_report>
我已经能够通过使用表达式获得base_price:
xpath(xml(outputs('InputXML')),'//base_price')
但是,我无法从 XML 中获取 fund_name 或 fund_valuation_date。
有人可以帮助我使用 XPath 表达式来获得这两个吗?
XML 文件目前只有一个fund_name,但将来可能会有更多,所以如果可能的话,我还应该使base_price 查询以该基金名称为条件?
【问题讨论】:
标签: xml xpath xml-namespaces power-automate