473,378 Members | 1,671 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,378 software developers and data experts.

Question about C# classes generated from a .xsd via xsd.exe in VS 2003

I have a schema that has been in existence over 1 year. I have been making a few minor modifications to it recently and suddenly
the generated C# classes have made a radical change.

I have just compared the xsd source to the last compiled version on 8/25/06 and they are identical, yet the generated C# is
different. I do not know enough about XSD and schemas to understand how the original output was generated, but I need to get it
back.

I am showing an excerpt from the schema and the old and new generated C# class.

<xs:complexType name="ListenerItem">
<xs:sequence>
<xs:choice id="HostFormat">
<xs:element name="HostName" type="mstns:FullyQualifiedNameType" />
<xs:element name="HostAddress" type="mstns:IPAddressTypeV4" />
<xs:element name="Any" type="xs:string" />
</xs:choice>
<xs:element ref="mstns:ClientType" />
<xs:element name="HostPort" type="mstns:PortNumberType" />
<xs:element name="NumThreads" type="xs:unsignedInt" />
<xs:element name="InitialState" type="mstns:ListenerState" />
<xs:element name="Name" type="xs:string" nillable="false"></xs:element>
<xs:element name="AllowGenericStation" type="xs:boolean" nillable="false" default="false"></xs:element>
<xs:element name="AllowClientSuppliedStation" type="xs:boolean" nillable="false" default="false" />
<xs:element name="AllowHostLookup" type="xs:boolean" nillable="false" default="false" />
<xs:element name="ClientVersion" type="mstns:ClientVersion" />
<xs:element name="EncryptionRequirements" type="mstns:EncryptionEnum" />
<xs:element name="AuthenicationRequirementsRequired" type="mstns:AuthenicationEnum" />
<xs:element name="AuthenicationRequirementsAllowed" type="mstns:AuthenicationEnum" />
<xs:element name="KeepAliveInterval" type="xs:unsignedInt" default="5" />
<xs:element name="KeepAliveUnits" type="KeepAliveUnitsType" default="Minutes" />
</xs:sequence>
</xs:complexType>

OLD C# Code
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Host Address", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Any" , typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Host Name", typeof(string))]
[System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")]
public string Item;

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public AddressTypeChoiceWithAny ItemElementName; <------------ see this line below

/// <remarks/>
public ClientType ClientType;
.......

NEW C# Code
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Host Address", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Any" , typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Host Name", typeof(string))]
[System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")]
public string Item;

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemChoiceType1 ItemElementName; <-------------- See type changed

/// <remarks/>
public ClientType ClientType;
.......

I would expect that most of you would say that I am crazy or that I have not been generating from the xsd that I though that I
had, but I have gone back in VSS for over the past year and that part of the schema has not changed and the generated C# has not
changed until today.

Could someone please tell me what to put into the schema to turn ItemChoiceType1 back to AddressTypeChoiceWithAny?

Thanks
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com
Sep 12 '06 #1
3 2075
"Roy Chastain" <ro*@kmsys.comwrote in message
news:39********************************@4ax.com...
>I have a schema that has been in existence over 1 year. I have been making
a few minor modifications to it recently and suddenly
the generated C# classes have made a radical change.
...
I would expect that most of you would say that I am crazy or that I have
not been generating from the xsd that I though that I
had, but I have gone back in VSS for over the past year and that part of
the schema has not changed and the generated C# has not
changed until today.
I see that you already know the answer to the question. Now, all you have to
do is believe it and figure out how it happened.

Either:

1) If you don't change anything, but something changes anyway, then it's
because something changed, possibly because you changed it.
2) If you change something, but the outputs don't change, then either you
didn't change it, or you're looking at the wrong outputs.

But you already know this, you just prefer to think that something magical
happened instead. It didn't. Get that clear in your mind, and you can begin
to solve the real problem.

John

"Once you have elimintated the impossible, that which remains, no matter how
unlikely, is the truth.", S. Holmes
Sep 12 '06 #2
Hi Roy,

The xsd.exe analyzes the whole schema and generates the class. A small
change may result in a big change as John mentioned. Do you have any
concern on the change of the generated class? If so, maybe we can find a
workaround for that.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Sep 13 '06 #3
Even though you havent changed the schema, did you upgrade your framework
from .NET 1.0/1.1 to .NET 2.0?

Thanks,
Priya

"Roy Chastain" <ro*@kmsys.comwrote in message
news:39********************************@4ax.com...
>I have a schema that has been in existence over 1 year. I have been making
a few minor modifications to it recently and suddenly
the generated C# classes have made a radical change.

I have just compared the xsd source to the last compiled version on
8/25/06 and they are identical, yet the generated C# is
different. I do not know enough about XSD and schemas to understand how
the original output was generated, but I need to get it
back.

I am showing an excerpt from the schema and the old and new generated C#
class.

<xs:complexType name="ListenerItem">
<xs:sequence>
<xs:choice id="HostFormat">
<xs:element name="HostName" type="mstns:FullyQualifiedNameType" />
<xs:element name="HostAddress" type="mstns:IPAddressTypeV4" />
<xs:element name="Any" type="xs:string" />
</xs:choice>
<xs:element ref="mstns:ClientType" />
<xs:element name="HostPort" type="mstns:PortNumberType" />
<xs:element name="NumThreads" type="xs:unsignedInt" />
<xs:element name="InitialState" type="mstns:ListenerState" />
<xs:element name="Name" type="xs:string" nillable="false"></xs:element>
<xs:element name="AllowGenericStation" type="xs:boolean" nillable="false"
default="false"></xs:element>
<xs:element name="AllowClientSuppliedStation" type="xs:boolean"
nillable="false" default="false" />
<xs:element name="AllowHostLookup" type="xs:boolean" nillable="false"
default="false" />
<xs:element name="ClientVersion" type="mstns:ClientVersion" />
<xs:element name="EncryptionRequirements" type="mstns:EncryptionEnum" />
<xs:element name="AuthenicationRequirementsRequired"
type="mstns:AuthenicationEnum" />
<xs:element name="AuthenicationRequirementsAllowed"
type="mstns:AuthenicationEnum" />
<xs:element name="KeepAliveInterval" type="xs:unsignedInt" default="5" />
<xs:element name="KeepAliveUnits" type="KeepAliveUnitsType"
default="Minutes" />
</xs:sequence>
</xs:complexType>

OLD C# Code

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Host Address",
typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Any" ,
typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Host Name",
typeof(string))]

[System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")]
public string Item;

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public AddressTypeChoiceWithAny ItemElementName; <------------ see
this line below

/// <remarks/>
public ClientType ClientType;
......

NEW C# Code

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Host Address",
typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Any" ,
typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Host Name",
typeof(string))]

[System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")]
public string Item;

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemChoiceType1 ItemElementName; <-------------- See type
changed

/// <remarks/>
public ClientType ClientType;
......

I would expect that most of you would say that I am crazy or that I have
not been generating from the xsd that I though that I
had, but I have gone back in VSS for over the past year and that part of
the schema has not changed and the generated C# has not
changed until today.

Could someone please tell me what to put into the schema to turn
ItemChoiceType1 back to AddressTypeChoiceWithAny?

Thanks
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com

Sep 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris F Clark | last post by:
1) I would really like to ask this on comp.lang.c#, but no such group exists. However, perhaps someone in one of the above two groups will know the answer and help me out. In my product, I use a...
12
by: mlimber | last post by:
This is a repost (with slight modifications) from comp.lang.c++.moderated in an effort to get some response. I am using Loki's Factory as presented in _Modern C++ Design_ for message passing in...
25
by: Andreas Fromm | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Im building an user database with many tables keeping the data for the Address, Phone numbers, etc which are referenced by a table where I...
30
by: Richard | last post by:
Level: Java newbie, C experienced Platform: Linux and Win32, Intel Another programmer and I are working on a small project together. He's writing a server process in Java that accepts input...
3
by: VR | last post by:
Hi, all. I have a rookie web development question. I am working on creating a web site, where all pages are going to have a similar look/feel: same menu on one side, company logo on the other...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
4
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
0
by: =?Utf-8?B?VG9tIE1jTGVvZA==?= | last post by:
We are migrating an application from VS.NET 2003 to VS 2005. The client and server have many types passed via web services that are shared in common assemblies. In VS.NET 2003, we used a custom...
9
by: Mike Hofer | last post by:
In a large application I'm working on (ASP.NET 1.1, VS2003), we have a base class that wraps stored procedures. Essentially, this base class (StoredProcedureBase) encapsulates the code to set up...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.