Medium severitydata quality
Power BI Refresh Error:
DF-Xml-InvalidElement
What does this error mean?
An XML element has a structure ADF cannot parse — mixed content (text and child elements combined), unexpected nesting depth, or a cardinality violation.
Common causes
- 1A mixed-content element contains both text content and child elements, which ADF XML parser cannot map to a single column
- 2An element expected to appear once appears multiple times in the file (cardinality violation), and the dataset schema expects a scalar value
- 3The XML file has deeper nesting than the dataset schema was imported from — elements at a deeper level than the configured row delimiter are being encountered
- 4The element contains CDATA sections or XML processing instructions that the parser is not configured to handle
- 5An empty element (<tag/>) is being mapped to a column type that does not accept empty values
How to fix it
- 1Read the error message in the ADF activity run output — it names the element and the line in the XML file where parsing failed.
- 2Open the failing XML file and inspect the element named in the error — look for mixed content, repeated elements, or unexpected nesting.
- 3In the XML dataset settings, verify the row delimiter element — this is the element ADF uses to split the file into rows, and elements deeper than this level are parsed as nested columns.
- 4Re-import the schema in the dataset settings after opening a representative XML file.
- 5If the element legitimately contains multiple child elements (array-like), configure the dataset to read it as a complex type and flatten it using a Flatten transformation in the data flow.
- 6For elements with CDATA content, check whether the 'Detect data type' or XML parser settings in the dataset can be adjusted to treat the content as a string.
Frequently asked questions
Official documentation: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-troubleshoot-guide