Jump to content

restriction base


Guest Laury

Recommended Posts

I am trying to use restriction base to create a new type from an existing type in another schema. I am getting the error "'TypeIdValueListRestricted' is not a valid restriction of the content model of complex type 'TypedIdValueList'". If I put the new restricted definition in the same file, I get no errors. Below are the three schema files I am using. The three.xsd is where I am using restriction and getting the error.----------------------------------------------------------------------------------------------------------------------------one.xsd:<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:two="http://path2/two" xmlns="http://path1/one" targetNamespace="http://path1/one" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://path2/two" schemaLocation="./two.xsd" id="idTwo"/> <xs:complexType name="TypeIdValueList"> <xs:sequence> <xs:element name="id" type="two:TypeId" minOccurs="0"/> <xs:element name="value" type="xs:double" minOccurs="1"/> <xs:element name="list" type="two:TypeListValue" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType></xs:schema>----------------------------------------------------------------------------------------------------------------------------two.xsd:<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://path2/two" targetNamespace="http://path2/two" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="TypeId"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="value" type="xs:double"/> </xs:sequence> </xs:complexType> <xs:complexType name="TypeListValue"> <xs:sequence> <xs:element name="itemName" type="xs:string"/> <xs:element name="itmeValue" type="xs:integer" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema>----------------------------------------------------------------------------------------------------------------------------three.xsd:<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:one="http://path1/one" xmlns:two="http://path2/two" xmlns="http://path3/three" targetNamespace="http://path3/three" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://path1/one" schemaLocation="./one.xsd" id="idOne"/> <xs:import namespace="http://path2/two" schemaLocation="./two.xsd" id="idTwo"/> <xs:complexType name="TypeIdValueListRestricted"> <xs:complexContent> <xs:restriction base="one:TypeIdValueList"> <xs:sequence> <!--xs:element name="id" type="two:TypeId" /--> <xs:element name="value" type="xs:double" minOccurs="1"/> <xs:element name="list" type="two:TypeListValue" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="list" type="one:TypeIdValueList" /></xs:schema>

Link to comment
Share on other sites

A stupid question really, so it may not be related, but why do you import two.xsd twice? I mean, there's once in one.xsd and once in three.xsd. Could that be it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...