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

Discussion in 'XML' started by puvit82, Jan 30, 2008.

  1. puvit82

    puvit82 Guest

    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?
     
    puvit82, Jan 30, 2008
    #1
    1. Advertising

  2. puvit82

    Pavel Lepin Guest

    Re: Re-using a simple type definition; with enumeration constraint and without enumeration constraint

    puvit82 <> wrote in
    <>:
    > 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.
     
    Pavel Lepin, Jan 31, 2008
    #2
    1. Advertising

  3. puvit82

    puvit82 Guest

    Re: Re-using a simple type definition; with enumeration constraintand without enumeration constraint

    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 <> wrote:
    > puvit82 <> wrote in
    > <>:
    >
    >
    >
    >
    >
    > > 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 -
     
    puvit82, Jan 31, 2008
    #3
  4. puvit82

    Pavel Lepin Guest

    Re: Re-using a simple type definition; with enumeration constraint and without enumeration constraint

    Please don't top-post. Fixed.

    puvit82 <> wrote in
    <>:
    > On Jan 31, 2:35 am, Pavel Lepin <>
    > wrote:
    >> puvit82 <> 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</>
     
    Pavel Lepin, Feb 1, 2008
    #4
  5. puvit82

    puvit82 Guest

    Re: Re-using a simple type definition; with enumeration constraintand without enumeration constraint

    On Feb 1, 3:09 am, Pavel Lepin <> wrote:
    > Please don't top-post. Fixed.
    >
    > puvit82 <> wrote in
    > <>:
    >
    >
    >
    >
    >
    > > On Jan 31, 2:35 am, Pavel Lepin <>
    > > wrote:
    > >> puvit82 <> 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
     
    puvit82, Feb 1, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stanimir Stamenkov
    Replies:
    2
    Views:
    749
    Stanimir Stamenkov
    Oct 25, 2005
  2. Jianli Shen
    Replies:
    1
    Views:
    594
    Victor Bazarov
    Mar 13, 2005
  3. Ark
    Replies:
    1
    Views:
    421
    Chris Torek
    Aug 7, 2004
  4. Jon Slaughter
    Replies:
    4
    Views:
    450
    Jon Slaughter
    Oct 26, 2005
  5. Pierre Yves
    Replies:
    2
    Views:
    490
    Pierre Yves
    Jan 10, 2008
Loading...

Share This Page