Jump to content
Sign in to follow this  
Guest Laury

restriction base

Recommended Posts

Guest Laury

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>

Share this post


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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...