Solved

Opening XML-file in Excel, parse-error

Posted on 2014-09-10
2
478 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 32

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now