Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AlexHeinze
Frequent Visitor

Handling of spaces when importing XML data

I'm using several sample XML files from an external system to test my report. This has been going well so far, but now two things cause problems. In one of the files I find an element with just whitespace in it:

<reason xml:space="preserve"> </reason>

The second file has whitespace somewhere else in the element:

<name>AM </name>

In both cases Power Query interprets the elements as tables instead of text. What is an elegant way that caters for both my "normal" XML content as well as these edge cases?

Appreciate your help!

 

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @AlexHeinze ;
You can check if these related post can is useful to you.

Import Data from XML Using Power Query | MyExcelOnline

A Primer on JSON and XML Files in Power BI (iterationinsights.com)

Power Query XML connector - Power Query | Microsoft Learn


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yalan, I did check these (and lots of others), but unfortunately they don't explain the handling of leading and trailing blanks in the XML.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors