Error E2001 - The schema does not contain any 'elements' so will not generate any classes.

Support FAQ > Liquid XML Data Binding

Wizard Error E2001


Message

The schema does not contain any 'elements' so will not generate any classes.

Explanation

Xml Schema elements can be considered as objects that have a type defined by the simple and complex types. So if no elements are specified in the schema, no classes will be generated as the optimiser will determine that none of the declared complexTypes will never be utilised.

Solution

The solution is to declare elements within the schema.

E.g. The following Xml Schema (XSD) will not generate any classes as no elements are defined.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:complexType name="Item">
    <xs:sequence>
      <xs:element name="Description" type="xs:string"/>
      <xs:element name="Quantity" type="xs:unsignedLong"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="QuotedItem">
    <xs:sequence>
      <xs:element name="Item" type="Item"/>
      <xs:element name="PricePerItemInPence" type="xs:unsignedLong" minOccurs="0"/>
      <xs:element name="CurrentAvalibility" type="xs:unsignedLong" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

However, by extending the schema to define the element QuoteRequest and its associated child elements, a full class hierarchy will be generated:

  <xs:element name="QuoteRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="CustomerID" type="xs:string"/>
        <xs:element name="Item" type="Item" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

See Also

Elements vs complexTypes


Add Feedback