XML defintion

Y

yasar.khan

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
 
J

Jure Sah

(e-mail address removed) 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
 
Y

yasar.khan

Jure said:
(e-mail address removed) pravi:

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

Boris Kolpackov

Hi Yasar,

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
 

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,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top