Jump to content
Sign in to follow this  
Guest Echidna

complex type extension

Recommended Posts

Guest Echidna

Hi folks, and pardon what must surely be a noob question.I'm having trouble extending (by restriction) a complextType that is defined in an imported xsd.the first xsd looks like this:<xs:schema targetNamespace="http://www.example.com/ns1" xmlns="http://www.example.com/ns1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="testComplexType"> <xs:sequence> <xs:element name="element1" maxOccurs="unbounded"/> <xs:element name="element2" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="testComplexTypeByRestriction"> <xs:complexContent> <xs:restriction base="testComplexType"> <xs:sequence> <xs:element name="element1" maxOccurs="1"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType></xs:schema>The file above validates just fine.The next file looks like this:<xs:schema xmlns:ns1="http://www.example.com/ns1" xmlns="http://www.example.com/ns2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://www.example.com" targetNamespace="http://www.example.com/differentFile" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://www.example.com/ns1" schemaLocation="Untitled21.xsd"/> <xs:complexType name="testComplexTypeByRestrictionInNs2"> <xs:complexContent> <xs:restriction base="ns1:testComplexType"> <xs:sequence> <xs:element name="element1" maxOccurs="1"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType></xs:schema>This xsd does NOT validate, "testComplexTypeByRestrictionInNs2 is not a valid restriction of the content model of complex type "testComplexType"What is it that I'm missing?Thanks very much in advance!Eric.

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.

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.

Sign in to follow this  

  • Create New...