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

5 views (last 30 days)
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);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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')

More Answers (0)

Products


Release

R14SP2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!