Solved

Opening XML-file in Excel, parse-error

Posted on 2014-09-10
2
625 Views
Last Modified: 2014-09-10
Hi

I have a simple XML-file:
<?xml version="1.0" encoding="iso-8859-1" ?>
<rootelement>
  <data>xy & z</data>
</rootelement>

Open in new window

If I open this in Excel 2013 I get a parse-error (cause of the special-character &).
in "http://support.microsoft.com/kb/238833/en-us" I can read that using "Encoding="iso-8859-1" I can use the special characters without encoding. But Excel fires a parse-error. Has I to change an option in Excel or may it be an error in Excel? Other apps like Notepad++ reads the file error-free. Thanks, Peter
0
Comment
Question by:formi
2 Comments
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40314172
The encoding is not the problem.

It's the specification of XML. There are exactly two characters which must be always escaped, cause they are not allowed as literals in any encoding: & (ampersand) and < (left angle bracket). Use &amp; and &lt; instead of those characters.

See also XML - 2.4 Character Data and Markup.

So you have two options:

<?xml version="1.0" encoding="iso-8859-1" ?>
<rootelement>
  <data>xy &amp; z</data>
</rootelement>

Open in new window


or using the CDATA tag, which makes here normally no sense:

<?xml version="1.0" encoding="iso-8859-1" ?>
<rootelement>
  <data>xy <![CDATA[&]]> z</data>
</rootelement>

Open in new window

0
 

Author Closing Comment

by:formi
ID: 40314207
Thanks for your Information!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question