xs:element with two types (xs:string and xs:int)

Discussion in 'XML' started by Adam Retter, Jun 9, 2005.

  1. Adam Retter

    Adam Retter Guest

    I would like to have an element defined in my XML Schema, that can hold
    either an xs:string or xs:int value. Is this possible?

    e.g. something like -

    <xs:element name="service">
    <xs:simpleType>
    <xs:restriction base="xs:string"/>
    <xs:restriction base="xs:int"/>
    </xs:simpleType>
    </xs:element>


    Thanks

    --
    Adam Retter
    Devon Portal Technician

    Devon Portal Project
    Devon e-Partnership
    County Hall
    Exeter
    Devon, UK.
     
    Adam Retter, Jun 9, 2005
    #1
    1. Advertising

  2. Adam Retter wrote:

    > I would like to have an element defined in my XML Schema, that can hold
    > either an xs:string or xs:int value. Is this possible?


    You can build a union of simple types e.g.
    <xs:union>
    however I am not sure what sense that makes for xs:string and xs:int as
    obviously xs:string contains any xs:int anyway.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jun 9, 2005
    #2
    1. Advertising

  3. Martin Honnen <> writes:

    > Adam Retter wrote:
    >
    > > I would like to have an element defined in my XML Schema, that can hold
    > > either an xs:string or xs:int value. Is this possible?

    >
    > You can build a union of simple types e.g.
    > <xs:union>
    > however I am not sure what sense that makes for xs:string and xs:int
    > as obviously xs:string contains any xs:int anyway.


    The lexical space of xsd:string contains the lexical space
    of xsd:int, but the value spaces are disjoint, and it
    can matter to an application which uses the type annotations
    provided by schema processing.

    -C. M. Sperberg-McQueen
    World Wide Web Consortium
     
    C. M. Sperberg-McQueen, Jun 10, 2005
    #3
    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. Schnoffos
    Replies:
    2
    Views:
    1,220
    Martien Verbruggen
    Jun 27, 2003
  2. Hal Styli
    Replies:
    14
    Views:
    1,646
    Old Wolf
    Jan 20, 2004
  3. arun
    Replies:
    8
    Views:
    457
    Dave Thompson
    Jul 31, 2006
  4. aling
    Replies:
    8
    Views:
    957
    Jim Langston
    Oct 20, 2005
  5. Replies:
    9
    Views:
    436
    James Kanze
    Apr 17, 2007
Loading...

Share This Page