1567785 - "Invalid 'name' attribute value ..." error when adding ADO.NET XML table to a Crystal Report using the database expert

SAP Knowledge Base Article - Public

1567785 - "Invalid 'name' attribute value ..." error when adding ADO.NET XML table to a Crystal Report using the database expert

Symptom

  • Add a ADO.NET XML table to a Crystal Report using the Database Expert.
  • An error occurs:
    • Logon Failed.
    • Details: System.Xml: Invalid 'name' attribute value 'YOUR FIELD NAME()':
    • 'The '(' character, hexadecimal value 0x28, at position # within the
    • name, cannot be included in a name.'.

adonet xml logon failed.png

Environment

  • Crystal Reports for Visual Studio 2010
  • Crystal Reports 2008
  • Crystal Reports XI R2

Reproducing the Issue

  1. Design a new report in Crystal Reports.
  2. Use the ADO.NET (XML) driver as your new connection.
  3. Select your XML schema (.xsd) and attempt to proceed in designing your report.
  4. An error occurs. See below for a sample schema.
  5. A similar data schema works with Microsoft SQL Server.

Sample XML Schema

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="ds_Data" targetNamespace="http://tempuri.org/ds_Data.xsd" elementFormDefault="qualified"
  attributeFormDefault="qualified" xmlns="http://tempuri.org/ds_Data.xsd" xmlns:mstns="http://tempuri.org/ds_Data.xsd"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="ds_Data" msdata:IsDataSet="true">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="MYDATA">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="DATA" type="xs:string" minOccurs="0" />
              <xs:element name="FONT_SIZE" type="xs:string" minOccurs="0" />
              <xs:element name="FONT_NAM(E)" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

Cause

  • The left and right parentheses characters are not supported in field names when using the ADO.NET (XML) driver.
  • This is in accordance with the XML W3C standards.

Resolution

  • Don't use left or right parentheses '(' or ')' in element names when using the ADO.NET (XML) driver.

Keywords

xml, xml w3c standard , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 4.0 ; SAP Crystal Reports XI R2 ; SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2005 ; SAP Crystal Reports, version for Visual Studio .NET 2008 ; SAP Crystal Reports, version for Visual Studio .NET 9.1