Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 31st, 2006, 08:45 PM
yasar.khan@gmail.com
Guest
 
Posts: n/a
Default XML defintion

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

  #2  
Old August 1st, 2006, 12:15 AM
Jure Sah
Guest
 
Posts: n/a
Default Re: XML defintion

yasar.khan@gmail.com pravi:
Quote:
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
  #3  
Old August 1st, 2006, 03:05 AM
yasar.khan@gmail.com
Guest
 
Posts: n/a
Default Re: XML defintion


Jure Sah wrote:
Quote:
yasar.khan@gmail.com pravi:
Quote:
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>

  #4  
Old August 1st, 2006, 08:55 AM
Boris Kolpackov
Guest
 
Posts: n/a
Default Re: XML defintion

Hi Yasar,

"yasar.khan@gmail.com" <yasar.khan@gmail.comwrites:
Quote:
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
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles