在逻辑应用程序中读取 XML 属性值的表达式

Expression to read XML attribute value in Logic Apps

在每个逻辑应用程序中,我正在迭代 XML 文档的一部分,该文档部分具有:

<Part ref="1">

我只想读出属性值。在这种情况下,“1”。我试过:

xpath(xml(item()),'Part/@ref')

然后我得到

["ref=\"1\""]

first(xpath(xml(item()),'Part/@ref'))

我明白了

ref="1"

我尝试合并 string() 和 value() 函数,但没有成功。只读出值的正确方法是什么?

试试这个 表达式:

'string(//Part/@ref)'

您必须在代码视图中使用此表达式:

@xpath(xml(item()), 'string(/*[local-name()=\"Part\" and namespace-uri()=\"\"]/@*[local-name()=\"ref\" and namespace-uri()=\"\"])')