Import Xml into excel: Invalid file reference/ Invalid characters (CData)

User999999 picture User999999 · Feb 6, 2014 · Viewed 8.5k times · Source

I'm having some problems importing an xml-file into excel.

The xml looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
      <documents>
           <document>
                <name><![CDATA[ file1-123 ]]></name>
                <title><![CDATA[ title file 1 ]]></title>
           </document>
           ... Some more docs...
           <document>
                <name><![CDATA[ file2-456 ]]></name>
                <title><![CDATA[ title file 2 ]]></title>
          </document>
      </documents>

When importing into excel 2007, i get the following error:

  Invalid file reference.The path to the file is invalid or multiple schemes 
  are not found.

According to the claims of my colleague this error is the result of invalid charachaters in the CData. But i'm having some troubles believing him. The only characters i know that are invalid:

{ < , > , ' , " , & }

Yet the characters he claims causing the errors are:

{ Â , ç , ° , ³ , ë }

example:<name><![CDATA[ file1³-123³ ]]></name>

But those characters are in the CDATA

Question: How is CDATA interpreted by excel during import?And what are the characters that CData may NOT contain?

Optional Question: Why is webutility.htmlencode (this solved the issue, but not the question) needed when outputting CData (or XML in its extend) from ASP.Net website?

Thanks for your time

Answer