Microsoft KB Archive/287076

= XL2002: XML File Is Treated as a Text File or a Blank File Is Opened =

Article ID: 287076

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft Excel 2002 Standard Edition

-



This article was previously published under Q287076





SYMPTOMS
When you attempt to open an Extensible Markup Language (XML) file with Microsoft Excel, one of the following behaviors may occur:
 * The file opens, but no text is displayed.

-or-
 * Excel starts the Text Import Wizard.



CAUSE
This behavior occurs when both of the following conditions are true:
 * You are opening an XML file or an XML file with an Extensible Stylesheet Language (XSL) style sheet.

-and-
 * The XML file or XSL style sheet has a line feed or carriage return character inside a <?XML?> header or between an opening ( ) and closing ( ) header.

Example 1: Line Feed or Carriage Return in XML File
For example, an XML file containing the following header exhibits the behavior described in the &quot;Symptoms&quot; section of this article:   1 

Example 2: Line Feed or Carriage Return in XSL File
The following XML file has an XSL style sheet called &quot;employees.xsl&quot;:     1 Davolio Nancy</FirstName> </Employees> If &quot;employees.xsl&quot; contains the following text, the following behavior is exhibited when you open the XML file and specify to apply the style sheet: <?xml version=&quot;1.0&quot;?> <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/TR/WD-xsl&quot; language=&quot;vbscript&quot;> <xsl:template match=&quot;/&quot;> <xsl:pi name=&quot;xml&quot;> version=&quot;1.0&quot; </xsl:pi> <Workbook xmlns=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot; xmlns:n1=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot;> <Worksheet n1:Name=&quot;Employees&quot;> </Worksheet> </Workbook> </xsl:template> </xsl:stylesheet> NOTE: The line that begins with <xsl:pi> has a carriage return before the </xsl:pi> header.

<div class="resolution_section">

RESOLUTION
To resolve this issue, edit the XML files and XSL style sheets to remove all carriage-return and line-feed characters from between the starting and ending headers. The preceding examples work correctly if changed to the following:

Example 1
<?xml version=&quot;1.0&quot;?>  1 </a>

Example 2
<?xml version=&quot;1.0&quot;?> <xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/TR/WD-xsl&quot; language=&quot;vbscript&quot;> <xsl:template match=&quot;/&quot;> <xsl:pi name=&quot;xml&quot;> version=&quot;1.0&quot; </xsl:pi> <Workbook xmlns=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot; xmlns:n1=&quot;urn:schemas-microsoft-com:office:spreadsheet&quot;> <Worksheet n1:Name=&quot;Employees&quot;> </Worksheet> </Workbook> </xsl:template> </xsl:stylesheet>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
Additional query words: XL2002

Keywords: kbbug kbpending KB287076

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.