Subject:Re-using a simple type definition; with enumeration constraint and without enumeration constraint Author:Puvit Singh Date:30 Jan 2008 05:20 PM
My problem is as follows, any advice / suggestion would be greatly appreciated:
Lets suppose that I have defined a simpleType "addressType" with 3 enumeration values (Home, Office, Vacation) that restrict data entry.
I want to use this simpleType in 2 different unrelated complexType definitions, lets call them "personalAddress" and "companyAddress"
How will I be able to use "addressType" inside "personalAddress" such that the 3 enumeration values are taken into consideration, i.e. data entry is restricted to either one of those three enumeration values and also use the same "addressType" inside "companyAddress" such that the enumeration values are not considered and the user can enter a completely different value for addressType (such as "HomeOffice" and the schema validates the XML file)?
I do not want to create another addressType (one with enumerations and one without - and different names)
Does anybody think that there is a way to re use the same simple type twice; once with the enumeration values and another time without the enumeration values?
Subject:Re-using a simple type definition; with enumeration constraint and without enumeration constraint Author:(Deleted User) Date:07 Feb 2008 05:20 AM
If the two address types have different enums, they are different types. If you want to reuse the common part of these types, you will need to separate it into its own type, and derive the other two by restriction.