I'm trying to use Microsoft Excel's FILTERXML function to grab data from an XML form.
I'm not quite sure why I'm unable to get a number response when I use certain XPath arguments.
Here's my XML:
<result>
<status>1</status>
<num_results>1</num_results>
<total_results>500</total_results>
<results_remaining>499</results_remaining>
<matches>
<match>
<radiant_team_id>0</radiant_team_id>
<dire_team_id>0</dire_team_id>
<players>
<player>
<account_id>141684701</account_id>
<player_slot>0</player_slot>
<hero_id>0</hero_id>
</player>
<player>
<account_id>4294967295</account_id>
<player_slot>1</player_slot>
<hero_id>0</hero_id>
</player>
<player>
<account_id>4294967295</account_id>
<player_slot>2</player_slot>
<hero_id>0</hero_id>
</player>
</players>
</match>
</matches>
</result>
I'm trying to use this XPath argument to count how many players pop up in a dynamic API that refreshes an XML form every so ofter. The player count varies from 0-10.
/result/matches/match/players[count(player)]
I get a #!VALUE error. Here's the MS Excel function argument I use:
=FILTERXML($A$2,"/result/matches/match/players/player[count(player)]")
Both arguments fail. Is there a way I can report how many player elements exist in the XML form by reporting to another cell in MS Excel?
No comments:
Post a Comment