473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MS XML Scheme defn tool and choices.(C#/.NET)

To quote the MS on-line help:
"The XmlChoiceIdentifierAttribute allows you to assign a special enumeration value to each instance of the member. You must either create the enumeration yourself or it can be generated by the XML Schema Definition Tool (Xsd.exe). "

Of course they neglect to tell you how to persuade it (xsd) to do this. I'm afraid I'm new to this XML lark, perhaps someone may enlighten me?

My xml schema includes the following...
Expand|Select|Wrap|Line Numbers
  1.   <xs:complexType name="Communications">
  2.     <xs:choice maxOccurs="1">
  3.       <xs:element name="serial" type="SerialPort" />
  4.       <xs:element name="tcp" type="TCPConnection" />
  5.     </xs:choice>
  6.   </xs:complexType>
  7.  
xsd currently gives me..
Expand|Select|Wrap|Line Numbers
  1. .
  2. /// <remarks/>
  3. [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
  4. [System.SerializableAttribute()]
  5. [System.Diagnostics.DebuggerStepThroughAttribute()]
  6. [System.ComponentModel.DesignerCategoryAttribute("code")]
  7. [System.Xml.Serialization.XmlTypeAttribute(Namespace="Anite/Terminal Automation Gateway")]
  8. public partial class Communications {
  9.  
  10.     private object itemField;
  11.  
  12.     /// <remarks/>
  13.     [System.Xml.Serialization.XmlElementAttribute("serial", typeof(SerialPort))]
  14.     [System.Xml.Serialization.XmlElementAttribute("tcp", typeof(TCPConnection))]
  15.     public object Item {
  16.         get {
  17.             return this.itemField;
  18.         }
  19.         set {
  20.             this.itemField = value;
  21.         }
  22.     }
  23. }
  24.  
Ta
Simon
Sep 14 '07 #1
2 1748
jkmyoung
2,057 Expert 2GB
http://www.w3schools.com/schema/schema_facets.asp
Expand|Select|Wrap|Line Numbers
  1. <xs:element name="car">
  2. <xs:simpleType>
  3.   <xs:restriction base="xs:string">
  4.     <xs:enumeration value="Audi"/>
  5.     <xs:enumeration value="Golf"/>
  6.     <xs:enumeration value="BMW"/>
  7.   </xs:restriction>
  8. </xs:simpleType>
  9. </xs:element> 
Sep 14 '07 #2
http://www.w3schools.com/schema/schema_facets.asp
Expand|Select|Wrap|Line Numbers
  1. <xs:element name="car">
  2. <xs:simpleType>
  3.   <xs:restriction base="xs:string">
  4.     <xs:enumeration value="Audi"/>
  5.     <xs:enumeration value="Golf"/>
  6.     <xs:enumeration value="BMW"/>
  7.   </xs:restriction>
  8. </xs:simpleType>
  9. </xs:element> 
Yes, thanks, I saw that but could see how to force the enumeration value to match the choice. I guess if I'm doing the writing then its up to me but otherwise ?
Sep 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: janie | last post by:
I have recently worked in .net with tool named "TierDeveloper" at http://www.alachisoft.com. and found it a nice O/R mapping tool. Did any one of u try it to share the experience with me?
1
by: Shan | last post by:
Is there any tool available for generating unit test code in .NET. This is reverse engineering process, which we have to unit test methods in a class. Tool such as Nunit can test the methods only...
4
by: G.Ashok | last post by:
Hi All Did any of you aware of the tool kit (framework) like Jtest (Automated Unit Test Case Designer/Creater) which extends the JUnit test framework to the work) is available for .NET? Or is...
3
by: fabian | last post by:
Hello, I am probably in the wrong forum but any direction would be appreciated. I recently installed the distributable for asp.net 2.0. I notice that with 2.0 the wizards (1.0, 1.1) are no longer...
0
by: jcatubay | last post by:
Hi, can anyone recommend me a good reporting tool in .NET? I just want to be able to generate a pdf file from my web application. I want to be able to have a button that user can click and pdf will...
1
by: SimonHeffer | last post by:
OK here's my (minimal) schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="fred" elementFormDefault="qualified" xmlns="fred" xmlns:mstns="http://tempuri.org/XMLSchema.xsd"...
1
by: mentor | last post by:
I'm running a small web site with IIS and asp.net on only one machine. There are alot of pics and posts. To improve performance, proper cache scheme is needed. I found memcached is good for...
2
by: mentor | last post by:
I'm running a small web site with IIS and asp.net on only one machine. There are alot of pics and posts. To improve performance, proper cache scheme is needed. I found memcached is good for...
3
by: Robert Kochem | last post by:
Hi, I have some problems locating .NET Framework Configuration Tool for configuring an snk as fully trusted. On the PC I want to do this only the frameworks up to 3.5 were installed therefore I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.