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 post
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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...