You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MS Flow中如何用XPath提取XML的compassid值生成纯值数组?

Fixing XPath to Extract Pure Text Values in MS Flow

Hey there! I see you're trying to pull the raw compassid values from your XML response in MS Flow, but right now you're getting those base64-encoded XML node objects instead. Let's fix that quickly.

Why Your Current XPath Isn't Working

The xpath() function in MS Flow returns XML node objects by default when you target element nodes (like /qdbapi/record/compassid), which is why you're seeing the $content-type and base64 $content fields. To get just the text inside those nodes, you need to adjust your XPath to target the text nodes directly.

Solution 1: Update Your XPath Expression

Modify your existing XPath to include /text() at the end, which tells the function to return the text content of the compassid elements instead of the elements themselves:

xpath(xml(body('CompassIDs')), '/qdbapi/record/compassid/text()')

This should return a clean array of pure values like:

["122542", "222222", "981344"]

Solution 2: Transform the Existing Result (If Solution 1 Doesn't Work)

For some edge cases, if you still end up with the node objects, you can use a Select action to convert them:

  1. Add a Select action to your flow.
  2. Set the From field to the output of your current xpath() expression.
  3. In the Map section, use this expression to decode the base64 content and extract the text:
    xpath(xml(decodeBase64(item()?['$content'])), 'text()')[0]
    
  4. The output of the Select action will be your desired array of pure compassid values.

That should get you exactly what you need!

内容的提问来源于stack exchange,提问作者Mack Phillips

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 20:27:41