Forum Discussion
XML import problem
- 10 months ago
Hi GrahamR ,
You are correct this is the expected behavior.
The reason you are seeing only null values is that the plain text “Site A” is not retained when Power BI parses the XML. The Xml.Tables function processes only structured elements and attributes, and in your file, “Site A” appears as loose text before the <Shelf> and <Box> elements. As a result, it is considered mixed content and omitted during import.
Since this text does not make it into Power Query, it cannot be retrieved by any M or DAX expressions after the XML is loaded.
The best solutions are to either update the XML so that “Site A” is within its own tag or attribute, or to read the file as raw text and extract the relevant section before <Shelf> using text functions prior to converting it to XML.
In summary, your understanding is correct the data loss occurs during the XML parsing stage, and is not due to any issues with your process.
Thank you,Tejaswi
Hi,
The XML isn't a standard XML file. "Site A" should be in a paire of tags or as an attribute.
<Location><site>Site A</site><Shelf>1</Shelf><Box>32</Box></Location>
or <Location site="Site A"><Shelf>1</Shelf><Box>32</Box></Location>