Power Automate - 云流 - 使用 xpath 作为父节点属性

问题描述 投票:0回答:1
  1. RESTful API 调用返回下面注明的 XML。

  2. 我需要为每个 ShowSurveyAnswerKey 循环执行各个步骤。所以在这种情况下,有 8 个。使用以下“应用到每个”步骤表达式即可:

xpath(xml(body('HTTP_Get')),'//ShowSurveyAnswer')
  1. 在“Apply to every”中,需要知道 ShowSurveyKey、ShowSurveyQuestionKey 和 ShowSurveyAnswerKey 的值。我唯一可以工作的是 ShowSurveyAnswerKey,我碰巧正在使用“撰写”动作进行测试,其表达式为:
xpath(item(),'string(/ShowSurveyAnswer/@ShowSurveyAnswerKey)')

所以真的,我无法在“应用到每个”中的 Power Automate Compose Expression 中找出父级或祖先或 ../。

非常感谢所有帮助。谢谢!

<?xml version="1.0" encoding="utf-8"?>
<Show ShowKey="123" >
    <ShowSurveys>
        <ShowSurvey ShowSurveyKey="230151" >
            <SurveyQuestions>
                <SurveyQuestion ShowSurveyQuestionKey="842125" >
                    <SurveyAnswers>
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3316719" />
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3316720" />
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3316721" />
                    </SurveyAnswers>
                </SurveyQuestion>
            </SurveyQuestions>
        </ShowSurvey>
        <ShowSurvey ShowSurveyKey="217418" >
            <SurveyQuestions>
                <SurveyQuestion ShowSurveyQuestionKey="808668" >
                    <SurveyAnswers>
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3192170" />
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3192174" />
                    </SurveyAnswers>
                </SurveyQuestion>
                <SurveyQuestion ShowSurveyQuestionKey="808669" >
                    <SurveyAnswers>
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3192175" />
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3192176" />
                        <ShowSurveyAnswer ShowSurveyAnswerKey="3192177" />
                    </SurveyAnswers>
                </SurveyQuestion>
            </SurveyQuestions>
        </ShowSurvey>
    </ShowSurveys>
</Show>
xpath power-automate
1个回答
0
投票

遇到类似的挑战。你能找到解决办法吗?

© www.soinside.com 2019 - 2024. All rights reserved.