MATLAB: Am I not able to read UTF-8 format files using the XMLREAD function in MATLAB 7.0.4 (R14SP2)

MATLABurlutfutf-8xmlread

I have XML-files that I am trying to read using the XMLREAD function. The files are in UTF-8 format. I receive the following error when I try to read UTF-8 format XML files:
[Fatal Error] :1:1: Content is not allowed in prolog.
??? Java exception occurred:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
.
Error in ==> xmlread at 94
parseResult = p.parse(fileName);

Best Answer

This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
There is a bug in MATLAB 7.0.4 (R14SP2) that affects the way XMLREAD handles XML-files that are in UTF-8 format.
To work around this issue, pass the file as a URL to the XMLREAD function. For example:
xmlread('file:///C:/myfolder/foo.xml')