Using xs:extension for xs:restriction giving error
Posted: Fri Apr 11, 2014 6:27 pm
Hi,
Not able to compile <xs:complexType name="ChargeableDataList"> in below code, urgent help required
Getting following Error:
[Xerces] derivation-ok-restriction.2.1.2: Error for type 'ChargeableDataList'. The attribute use 'Name' in this type has type 'ChargeableEntity', which is not validly derived from 'StringMin1', the type of the matching attribute use in the base type.
Not able to compile <xs:complexType name="ChargeableDataList"> in below code, urgent help required
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="StringMin1">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CustomData">
<xs:annotation>
<xs:documentation>Additional implementation specific data that is required for rating</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Name" type="StringMin1"/>
<xs:element name="Value" type="xs:string">
<xs:annotation>
<xs:documentation>When the type is date, the format must be dd-mm-yyyy. Example: 25-11-2007</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="STRING"/>
<xs:enumeration value="INTEGER"/>
<xs:enumeration value="DOUBLE"/>
<xs:enumeration value="DATE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CustomDataList">
<xs:annotation>
<xs:documentation>Additional implementation specific data that is required for rating</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Data" type="CustomData" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="Name" type="StringMin1" use="optional"/>
</xs:complexType>
<xs:complexType name="ChargeableDataType">
<xs:complexContent>
<xs:extension base="CustomData">
<xs:sequence>
<xs:element name="Location" type="xs:string" minOccurs="0"/>
<xs:element name="Surcharges" minOccurs="0">
<xs:annotation>
<xs:documentation>If surcharges are applicable to this type, those surcharges are attached in the response</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="SurchargeInfo" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Adjustments" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="SurchargeAdjustment" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ChargeableDataList">
<xs:complexContent>
<xs:restriction base="CustomDataList">
<xs:sequence>
<xs:element name="Data" type="ChargeableDataType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="Name" type="ChargeableEntity" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ChargeableInfoType">
<xs:annotation>
<xs:documentation>Specify sets of values for catagories like documents, day factors, etc. so that charges can be attached</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="ChargeableInfo" type="ChargeableDataList" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ChargeableEntity">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Document"/>
<xs:enumeration value="DayFactor"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="StringMin1"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:schema>
[Xerces] derivation-ok-restriction.2.1.2: Error for type 'ChargeableDataList'. The attribute use 'Name' in this type has type 'ChargeableEntity', which is not validly derived from 'StringMin1', the type of the matching attribute use in the base type.