MetricSign
EN|NLRequest Access
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

  1. 1Read the error message in the ADF activity run output — it names the element and the line in the XML file where parsing failed.
  2. 2Open the failing XML file and inspect the element named in the error — look for mixed content, repeated elements, or unexpected nesting.
  3. 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.
  4. 4Re-import the schema in the dataset settings after opening a representative XML file.
  5. 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.
  6. 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

What is a mixed-content element and why does it cause parsing errors?

A mixed-content element contains both text and child elements — e.g., <Description>See <b>note</b> below</Description>. ADF can't map this to a flat column. Replace with a CDATA section or restructure the XML to eliminate mixed content.

How does the row delimiter element affect XML parsing in ADF?

The 'Row delimiter element' defines which XML element ADF treats as a single row — its children become columns. If set at the wrong level, ADF encounters elements it cannot map to columns.

Can this error appear on some XML files but not others?

Yes — XML files from the same source can have structural variations. If some files have a repeated or nested element where others have a simple one, the error appears only for those files.

Will downstream Power BI datasets be affected?

Yes — the pipeline fails and the downstream table receives no new data.

Official documentation: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-troubleshoot-guide

Other data quality errors