Jump to content

complex type extension


Guest Echidna
 Share

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.

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
 Share

×
×
  • Create New...