Rank: Newbie
Joined: 12/28/2009 Posts: 1
|
I was fighting for one day with this issue, before I realize it could be an XMLSpy problem.
I wish to restrict a type from another namespace defined in an external schema.
Schema of the base type
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.controlchainmanagement.org/Lean8895-ULO" targetNamespace="http://www.controlchainmanagement.org/Lean8895-ULO" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:complexType name="basetype"> <xsd:sequence> <xsd:element name="el1" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
Schema of the restricted type (not yet restricted)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ulo="http://www.controlchainmanagement.org/Lean8895-ULO" xmlns="http://www.controlchainmanagement.org/Lean8895-ULO/ISA-95" targetNamespace="http://www.controlchainmanagement.org/Lean8895-ULO/ISA-95" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:import namespace="http://www.controlchainmanagement.org/Lean8895-ULO" schemaLocation="Lean8895-ULO_draft01.xsd"/> <xsd:complexType name="derivedtype"> <xsd:complexContent> <xsd:restriction base="ulo:basetype"> <xsd:sequence> <xsd:element name="el1" type="xsd:string"/> </xsd:sequence> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema>
This validate without any problem using W3C xsv XMLSpy complains: File E:\2-CCM\D-8895ULO\XMLSchema\Lean8895-ISA-95_draft01.xsd is not valid. Type 'derivedtype' is not a valid restriction of type 'basetype'. (see Details) Error location: xsd:schema / xsd:complexType / xsd:complexContent / xsd:restriction / @base Details rcase-NameAndTypeOK.1: The declarations' {name}s and {target namespace}s are not the same: restriction element is <xsd:element name="el1"> and base element is <xsd:element name="el1">. rcase-Recurse.2.2: Mandatory <xsd:element name="el1"> is missing in the <sequence>. derivation-ok-restriction.5.4: The content type <xsd:sequence> is not a valid restriction of content type <xsd:sequence>.
Any idea or help to make XMLSpy happy?
Thanks
|
Rank: Newbie
Joined: 10/28/2002 Posts: 1,283 Location: AT
|
Hi,
just set "elementformdefault" to "unqualfied" in both schemas.
|