Skip to main content

Notifications

Community site session details

Community site session details

Session Id : C+2kk97DMLFeA1M8B3oZkr
Power Automate - General Discussion
Suggested answer

XML data gathering not working

Like (1) ShareShare
ReportReport
Posted on 28 Aug 2024 17:47:21 by Microsoft Employee
I am trying to pull weather information from the National Weather Service website for the forecast information for my area. They have an XML link available on the page that I am using an HTTP request to grab the XML data, but when I try to use xpaths to separate out the data I can't get all the information in the XML. I've tried using composes and variables, but it still won't grab the full week's worth of data.
 
The end goal for this is parsing out the information for each day so that it can be used to send out an email to our team for that week's weather and any potential hazards upcoming (weekly recurrence on Monday morning).
 
Categories:
  • Suggested answer
    WillPage Profile Picture
    1,907 on 28 Aug 2024 at 23:04:27
    XML data gathering not working
    Yeah seriously, just convert that to JSON and work with that - it's a million times easier. There are a few niche little things you can do in xpath that don't have corresponding functions in Power Automate/Logic Apps but in your use you can likely do everything you nneed by converting that document to JSON then use filter, select or whatever to transform the data how you want.

    It's a complicated data structure but you can parse it to produce a table using JSON functions e.g

    Convert to JSON

    Make a 7 day range
    Convert it to an object

    Filter for the time layout you want

    Grab your min temps

    And your max temps
    Day names

    Put it all together


    The result:


    Now just expand this solution to include other things from the forecast such as the probability of precip or whatever.

    I appreciate this is hard to replicate based on screen shots so I give you the flow to get you started, DM me for that because I can't attach it here. Good luck,
  • David_MA Profile Picture
    10,895 Super User 2025 Season 1 on 28 Aug 2024 at 18:18:10
    XML data gathering not working
    If you don't want to go with my suggestion about the weather action, what have you done so far to extract the XML data. I am by no means an expert, but I needed to get XML data from a Nintex form's repeating section.
    1. First pass the XML data through a Compose action.
    2. Then add another Compose action and enter this expression to convert the output of the above action to JSON: json(xml(outputs('Compose')))
    3. Add a condition to check if the data is an array: contains(string(outputs('Compose_Convert_to_JSON')),'"Items":{"Item":[')
    4. Then on each side of the condition, add a Parse JSON action on the output of the converted data.
     
    This is what it looks like in one of my flows:
    My XML data is rather simple. I am guessing the weather data XML will be much more complex so this may not work or may pose more challenges than I had. this is how simple my XML data is:
    <?xml version="1.0" encoding="utf-8"?><RepeaterData><Version>1.0</Version><Items><Item><_742b7b5ba81990ff42f64375dfdbf9ce type="System.String">1572</_742b7b5ba81990ff42f64375dfdbf9ce><_07ad023fa1054202079382704836c26d type="System.Int64">1</_07ad023fa1054202079382704836c26d><_b7d170afb19bdfe87ef25ff3aa566ada type="System.String">176239869</_b7d170afb19bdfe87ef25ff3aa566ada></Item></Items></RepeaterData>
     
  • David_MA Profile Picture
    10,895 Super User 2025 Season 1 on 28 Aug 2024 at 18:05:51
    XML data gathering not working
    I would use the Get Current Weather action in Power Automate. Parsing XML data is challenging to say the least with Power Automate. With the action you just specify the location and choose your unit of measurement. It returns over 30 pieces of detail about the weather for that location.

    Here are details of the action: MSN Weather - Connectors | Microsoft Learn

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
rpersad Profile Picture

rpersad 16

#2
David_MA Profile Picture

David_MA 10 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

Overall leaderboard
Loading started
Loading complete