E derivation-ok-restriction.5.4.2
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
E derivation-ok-restriction.5.4.2
Hi,
I'm having the subsequent XSD, where I try to apply a restriction to the complex type AUPriceType:
When trying to validate I receive the error messages:
Regards
Alex
I'm having the subsequent XSD, where I try to apply a restriction to the complex type AUPriceType:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="AUPriceType">
<xs:sequence>
<xs:element name="Carrier" minOccurs="0">
<xs:complexType>
<xs:attribute name="Code" type="xs:string" use="optional"/>
<xs:attribute name="Original" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="AdultAbsoluteValue" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="TotalDuration" type="xs:short" use="optional"/>
<xs:attribute name="NightsOfStay" type="xs:short" use="optional"/>
<xs:attribute name="Amount" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="SeasonChar" type="xs:string" use="optional"/>
<xs:attribute name="SeasonCharRef" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="PricesType">
<xs:sequence>
<xs:element name="Price" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="AUPriceType">
<xs:sequence>
<xs:element name="Carrier" minOccurs="0" maxOccurs="0">
<xs:complexType>
<xs:attribute name="Code" type="xs:string" use="optional"/>
<xs:attribute name="Original" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="AdultAbsoluteValue" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="TotalDuration" type="xs:short" use="prohibited"/>
<xs:attribute name="NightsOfStay" type="xs:short" use="optional"/>
<xs:attribute name="Amount" type="xs:positiveInteger" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="SeasonChar" type="xs:string" use="prohibited"/>
<xs:attribute name="SeasonCharRef" type="xs:string" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Any help on the problem is truly appreciated. Tanks in advance for your help!!Position: 25:21
E rcase-Recurse.2: There is not a complete functional mapping between the particles.
URL: http://www.w3.org/TR/xmlschema-1/#rcase-Recurse
Position: 25:21
E derivation-ok-restriction.5.4.2: Error for type '#AnonType_PricePricesType'. The particle of the type is not a valid restriction of the particle of the base.
URL: http://www.w3.org/TR/xmlschema-1/#deriv ... estriction
Regards
Alex
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hello Alex,
The problem is that the complex type for the Price element cannot be derived from the AUPriceType because the AdultAbsoluteValue element is locally defined and has unrelated types. The relevant place in the specification is:
http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK
3.2.5 R's {type definition} is validly derived given {extension, list, union} from B's {type definition} as defined by Type Derivation OK (Complex) (§3.4.6) or Type Derivation OK (Simple) (§3.14.6), as appropriate.
Note: The above constraint on {type definition} means that in deriving a type by restriction, any contained type definitions must themselves be explicitly derived by restriction from the corresponding type definitions in the base definition, or be one of the member types of a corresponding union.
You can solve this if you make the type for AdultAbsoluteValue from the derived type derived from the type of AdultAbsoluteValue from the base type as below:
Best Regards,
George
The problem is that the complex type for the Price element cannot be derived from the AUPriceType because the AdultAbsoluteValue element is locally defined and has unrelated types. The relevant place in the specification is:
http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK
3.2.5 R's {type definition} is validly derived given {extension, list, union} from B's {type definition} as defined by Type Derivation OK (Complex) (§3.4.6) or Type Derivation OK (Simple) (§3.14.6), as appropriate.
Note: The above constraint on {type definition} means that in deriving a type by restriction, any contained type definitions must themselves be explicitly derived by restriction from the corresponding type definitions in the base definition, or be one of the member types of a corresponding union.
You can solve this if you make the type for AdultAbsoluteValue from the derived type derived from the type of AdultAbsoluteValue from the base type as below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="AdultAbsoluteValueType">
<xs:attribute name="TotalDuration" type="xs:short" use="optional"/>
<xs:attribute name="NightsOfStay" type="xs:short" use="optional"/>
<xs:attribute name="Amount" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
<xs:complexType name="AUPriceType">
<xs:sequence>
<xs:element name="Carrier" minOccurs="0">
<xs:complexType>
<xs:attribute name="Code" type="xs:string" use="optional"/>
<xs:attribute name="Original" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="AdultAbsoluteValue" maxOccurs="unbounded" type="AdultAbsoluteValueType"/>
</xs:sequence>
<xs:attribute name="SeasonChar" type="xs:string" use="optional"/>
<xs:attribute name="SeasonCharRef" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="PricesType">
<xs:sequence>
<xs:element name="Price" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="AUPriceType">
<xs:sequence>
<xs:element name="Carrier" minOccurs="0" maxOccurs="0">
<xs:complexType>
<xs:attribute name="Code" type="xs:string" use="optional"/>
<xs:attribute name="Original" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="AdultAbsoluteValue" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="AdultAbsoluteValueType">
<xs:attribute name="TotalDuration" type="xs:short" use="prohibited"/>
<xs:attribute name="NightsOfStay" type="xs:short" use="optional"/>
<xs:attribute name="Amount" type="xs:positiveInteger" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="SeasonChar" type="xs:string" use="prohibited"/>
<xs:attribute name="SeasonCharRef" type="xs:string" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service