XML defintion

Discussion in 'XML' started by yasar.khan@gmail.com, Jul 31, 2006.

  1. Guest

    Is there any way we can replicate language "c" enum in XML schema? for
    example

    enum
    {
    GREEN =1001,
    YELLOW
    RED
    }

    so in c once you refer GREEN it means 1001. Do we have anything like
    this in XML schema?

    Yasar
     
    , Jul 31, 2006
    #1
    1. Advertising

  2. Jure Sah Guest

    pravi:
    > Is there any way we can replicate language "c" enum in XML schema? for
    > example
    >
    > enum
    > {
    > GREEN =1001,
    > YELLOW
    > RED
    > }
    >
    > so in c once you refer GREEN it means 1001. Do we have anything like
    > this in XML schema?


    <enum>
    <green value=1001 />
    <yellow />
    <red />
    </enum>

    --
    Primary function: Coprocessor
    Secondary function: Cluster commander

    http://www.thought-beacon.net

    Pay once per lifetime webhosting:
    http://farcomm-it.com/?ref=jsah

    We are the paragon of humanity. You may worship us. From afar.

    01010010 01100101 01110011 01101001 01100100 01100101 01101110 01110100
    01000010 01000001 01010011 01001001 01000011
     
    Jure Sah, Aug 1, 2006
    #2
    1. Advertising

  3. Guest

    Jure Sah wrote:
    > pravi:
    > > Is there any way we can replicate language "c" enum in XML schema? for
    > > example
    > >
    > > enum
    > > {
    > > GREEN =1001,
    > > YELLOW
    > > RED
    > > }
    > >
    > > so in c once you refer GREEN it means 1001. Do we have anything like
    > > this in XML schema?

    >
    > <enum>
    > <green value=1001 />
    > <yellow />
    > <red />
    > </enum>
    >
    > --
    > Primary function: Coprocessor
    > Secondary function: Cluster commander
    >
    > http://www.thought-beacon.net
    >
    > Pay once per lifetime webhosting:
    > http://farcomm-it.com/?ref=jsah
    >
    > We are the paragon of humanity. You may worship us. From afar.
    >
    > 01010010 01100101 01110011 01101001 01100100 01100101 01101110 01110100
    > 01000010 01000001 01010011 01001001 01000011


    No I have to define like this and I have no way to assign value to
    individual element.
    <xsd:simpleType name="floodEnum">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="unicast"/>
    <xsd:enumeration value="multicast"/>
    <xsd:enumeration value="broadcast"/>
    <xsd:enumeration value="all"/>
    </xsd:restriction>
    </xsd:simpleType>
     
    , Aug 1, 2006
    #3
  4. Hi Yasar,

    "" <> writes:

    > Is there any way we can replicate language "c" enum in XML schema? for
    > example
    >
    > enum
    > {
    > GREEN =1001,
    > YELLOW
    > RED
    > }
    >
    > so in c once you refer GREEN it means 1001. Do we have anything like
    > this in XML schema?


    XML Schema describes what will be allowed in XML instances. It can either
    be GREEN (e.g., as a string) or 1001 (as an integer). The fact that GREEN
    means 1001 is an application-specific logic. So I suggest that you simply
    translate enum symbols to numbers (or to C enumerators) in your
    application. Though this can be a major inconvenience if you are using
    XML data binding and the tool generates C/C++ enums that start from 0.


    hth,
    -boris


    --
    Boris Kolpackov
    Code Synthesis Tools CC
    http://www.codesynthesis.com
    Open-Source, Cross-Platform C++ XML Data Binding
     
    Boris Kolpackov, Aug 1, 2006
    #4
    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. Bardo
    Replies:
    3
    Views:
    1,206
    Bardo
    Jul 11, 2004
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    534
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Lord0
    Replies:
    3
    Views:
    531
    Lord0
    Feb 26, 2007
  4. Replies:
    4
    Views:
    628
    Jim Langston
    Oct 2, 2006
  5. Amit_Basnak
    Replies:
    5
    Views:
    473
    Amit_Basnak
    Dec 28, 2006
Loading...

Share This Page