PRB: XML Parser: Invalid Character Was Found in Text Content

ID: Q238833


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) version 5


SYMPTOMS

When parsing XML that contains "special characters" using the Microsoft XML parser (MSXML), the parser may report the following error message at the line and position of the first special character:

An Invalid character was found in text content.


CAUSE

The XML document is not marked with the proper character encoding scheme.


RESOLUTION

Specify the proper encoding scheme in the XML processing instruction.

- or -

Re-encode the XML data as proper UTF-8.


STATUS

This behavior is by design.


MORE INFORMATION

"Special character" refers to any character outside the standard ASCII character set range of 0x00 - 0x7F, such as Latin characters with accents, umlauts, or other diacritics. The default encoding scheme for XML documents is UTF-8, which encodes ASCII characters with a value of 0x80 or higher differently than other standard encoding schemes.

Most often, you will see this problem if you are working with data that uses the simple "iso-8859-1" encoding scheme. In this case, the quickest solution is usually the first listed prior in the RESOLUTION section. For example, use the following XML declaration:


   <?xml version="1.0" encoding="iso-8859-1" ?>
   <rootelement>
   ...XML data...
   </rootelement> 
Alternatively, you can encode each of those characters using the numeric entity reference, for example, use &#169; instead of the copyright character.

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Jason Strayer, Microsoft Corporation

Additional query words:

Keywords : kbGrpInet kbIE500 kbXML kbDSupport kbIEFAQ
Version : WINDOWS:5
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: February 1, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.