Re-using a simple type definition; with enumeration constraint andwithout enumeration constraint

P

puvit82

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?
 
P

Pavel Lepin

puvit82 said:
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?

It's in no way the "same simple type" if in one case it's an
enumeration, and in the other case it isn't. Why do you
want to use the same type name to designate two vastly
different things? To introduce some unnecessary confusion?
 
P

puvit82

pavel, i want to be able to use the same schema type because the
schema is set and has been communicated to the recipients; making a
change now will cause them to have to update their schema and their
mapping code (which is something i want to avoid)
I know that I could create a new with a different name and without
enumerations and use it but thats not how i want to go about it!? :(
unnecessary complexity .. i know!
 
P

Pavel Lepin

Please don't top-post. Fixed.

puvit82 said:
pavel, i want to be able to use the same schema type
because the schema is set and has been communicated to the
recipients; making a change now will cause them to have to
update their schema and their mapping code (which is
something i want to avoid)

You're missing the point. The types are different. You
cannot refer to two different types by just one name.
Either define two types, or use one unconstrained type and
check constraints on the application side.
 
P

puvit82

Please don't top-post. Fixed.

<5ec7e626-5e39-495a-96dc-4f76405b9...@q21g2000hsa.googlegroups.com>:







You're missing the point. The types are different. You
cannot refer to two different types by just one name.
Either define two types, or use one unconstrained type and
check constraints on the application side.

Pavel, Thanks for the responses! .. I'm going to go ahead and create
two different types.

Puvit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top