29 November 2012

Export Excel to XML error : A mapped element's relationship with other elements cannot be preserved

 When trying to export some data from an Excel file to an XML, I got the following error :
A mapped element's relationship with other elements cannot be preserved
To get around this error, I've simply deleted the unused/unmapped columns in order that all my exported columns were contiguous.

The reason is that when you map the fields described in your XSD schema with the columns in Excel, Excel is creating a table.
If the mapped columns are not contiguous, your data will be included in more than one table and Excel does not allow to export it.