SAP Knowledge Base Article - Public

2521213 - Error: 'The 'minOccurs' attribute cannot be present', when attempting to create a report based on ADO.NET (XML) in Crystal Reports

Symptom

  • Error: 'The 'minOccurs' attribute cannot be present'
  • When trying to report off an XML file, it fails with an error.
  • When attempting to create a report off an XML file using the ADO.NET (XML) driver, in Crystal Reports, it fails with the error:
        
          'Logon failed.
           Details: <XML FILE NAME.XML>: The 'minOccurs' attribute cannot be present.'
           

         1.jpg

Environment

  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016

Reproducing the Issue

  1. Create a new report in Crystal Reports designer.
  2. Choose the ADO.NET (XML) driver.
  3. Select the XML schema and click on Finish. (See below the sample schema.)
  4. It then displays the error:
            
    "Logon failed. Details: System.Xml : The 'minOccurs' attribute cannot be present."
       
      
    Sample XML file:
      
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="computer" minOccurs="1">
        <xs:complexType>
          <xs:all>
            <xs:element name="keyboard" minOccurs="0"/>
            <xs:element name="mouse" minOccurs="0"/>
            <xs:element name="monitor" minOccurs="0"/>
          </xs:all>
        </xs:complexType>
      </xs:element>
    </xs:schema>

Cause

  • The reason this error occurs, it's because the minOccurs and maxOccurs attributes are not allowed on top-level <element> elements neither in XSD 1.0 nor in XSD 1.1. (For more information: W3C XML Schema Definition Language (XSD) 1.1 Section 3.3.2)
      
  • XML Schema Definition Language (XSD) 1.1 is not supported in ADO.NET driver.

Resolution

  • Update the XML file to meet the XML Schema Definition Language (XSD) 1.0, which is fully supported in Crystal Reports.

Keywords

crystal, xml, ado.net, schema, minoccurs, attribute cannot be present, logon failed, xsd 1.1 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016