Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Re-using a simple type definition; with enumeration constraint andwithout enumeration constraint

Reply
Thread Tools

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

 
 
puvit82
Guest
Posts: n/a
 
      01-30-2008
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?
 
Reply With Quote
 
 
 
 
Pavel Lepin
Guest
Posts: n/a
 
      01-31-2008

puvit82 <(E-Mail Removed)> wrote in
<(E-Mail Removed)>:
> 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?

--
....also, I submit that we all must honourably commit seppuku
right now rather than serve the Dark Side by producing the
HTML 5 spec.
 
Reply With Quote
 
 
 
 
puvit82
Guest
Posts: n/a
 
      01-31-2008
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!

On Jan 31, 2:35*am, Pavel Lepin <(E-Mail Removed)> wrote:
> puvit82 <(E-Mail Removed)> wrote in
> <(E-Mail Removed)>:
>
>
>
>
>
> > 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?
>
> --
> ...also, I submit that we all must honourably commit seppuku
> right now rather than serve the Dark Side by producing the
> HTML 5 spec.- Hide quoted text -
>
> - Show quoted text -


 
Reply With Quote
 
Pavel Lepin
Guest
Posts: n/a
 
      02-01-2008

Please don't top-post. Fixed.

puvit82 <(E-Mail Removed)> wrote in
<(E-Mail Removed)>:
> On Jan 31, 2:35*am, Pavel Lepin <(E-Mail Removed)>
> wrote:
>> puvit82 <(E-Mail Removed)> wrote:
>> > 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)?

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

>
> 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.

--
<>There is no phenotype</>
 
Reply With Quote
 
puvit82
Guest
Posts: n/a
 
      02-01-2008
On Feb 1, 3:09*am, Pavel Lepin <(E-Mail Removed)> wrote:
> Please don't top-post. Fixed.
>
> puvit82 <(E-Mail Removed)> wrote in
> <(E-Mail Removed)>:
>
>
>
>
>
> > On Jan 31, 2:35*am, Pavel Lepin <(E-Mail Removed)>
> > wrote:
> >> puvit82 <(E-Mail Removed)> wrote:
> >> > 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)?

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

>
> > 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.
>
> --
> <>There is no phenotype</>- Hide quoted text -
>
> - Show quoted text -


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

Puvit
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sizeof((type)) is a constraint violation? Noob C Programming 4 03-08-2012 06:15 AM
proposal for template type parameter constraint wkaras@yahoo.com C++ 4 08-23-2005 11:56 PM
keyref constraint as part of type - impossible? Ian Pilcher XML 2 08-22-2005 01:47 PM
Setting a Custom Control Property that is an enumeration (or other non primative type) from aspx page Earl Teigrob ASP .Net 4 05-19-2004 06:55 PM
HTML + <input type=file> constraint doesnt work Bhavin ASP General 4 10-23-2003 04:40 PM



Advertisments