473,659 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:complexTy pe name="ListenerI tem">
<xs:sequence>
<xs:choice id="HostFormat" >
<xs:element name="HostName" type="mstns:Ful lyQualifiedName Type" />
<xs:element name="HostAddre ss" type="mstns:IPA ddressTypeV4" />
<xs:element name="Any" type="xs:string " />
</xs:choice>
<xs:element ref="mstns:Clie ntType" />
<xs:element name="HostPort" type="mstns:Por tNumberType" />
<xs:element name="NumThread s" type="xs:unsign edInt" />
<xs:element name="InitialSt ate" type="mstns:Lis tenerState" />
<xs:element name="Name" type="xs:string " nillable="false "></xs:element>
<xs:element name="AllowGene ricStation" type="xs:boolea n" nillable="false " default="false" ></xs:element>
<xs:element name="AllowClie ntSuppliedStati on" type="xs:boolea n" nillable="false " default="false" />
<xs:element name="AllowHost Lookup" type="xs:boolea n" nillable="false " default="false" />
<xs:element name="ClientVer sion" type="mstns:Cli entVersion" />
<xs:element name="Encryptio nRequirements" type="mstns:Enc ryptionEnum" />
<xs:element name="Authenica tionRequirement sRequired" type="mstns:Aut henicationEnum" />
<xs:element name="Authenica tionRequirement sAllowed" type="mstns:Aut henicationEnum" />
<xs:element name="KeepAlive Interval" type="xs:unsign edInt" default="5" />
<xs:element name="KeepAlive Units" type="KeepAlive UnitsType" default="Minute s" />
</xs:sequence>
</xs:complexType>

OLD C# Code
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName", typeof(string))]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;

/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
public AddressTypeChoi ceWithAny ItemElementName ; <------------ see this line below

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

NEW C# Code
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName", typeof(string))]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;

/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
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 AddressTypeChoi ceWithAny?

Thanks
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com
Sep 12 '06 #1
3 2094
"Roy Chastain" <ro*@kmsys.comw rote in message
news:39******** *************** *********@4ax.c om...
>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.comw rote in message
news:39******** *************** *********@4ax.c om...
>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:complexTy pe name="ListenerI tem">
<xs:sequence>
<xs:choice id="HostFormat" >
<xs:element name="HostName" type="mstns:Ful lyQualifiedName Type" />
<xs:element name="HostAddre ss" type="mstns:IPA ddressTypeV4" />
<xs:element name="Any" type="xs:string " />
</xs:choice>
<xs:element ref="mstns:Clie ntType" />
<xs:element name="HostPort" type="mstns:Por tNumberType" />
<xs:element name="NumThread s" type="xs:unsign edInt" />
<xs:element name="InitialSt ate" type="mstns:Lis tenerState" />
<xs:element name="Name" type="xs:string " nillable="false "></xs:element>
<xs:element name="AllowGene ricStation" type="xs:boolea n" nillable="false "
default="false" ></xs:element>
<xs:element name="AllowClie ntSuppliedStati on" type="xs:boolea n"
nillable="false " default="false" />
<xs:element name="AllowHost Lookup" type="xs:boolea n" nillable="false "
default="false" />
<xs:element name="ClientVer sion" type="mstns:Cli entVersion" />
<xs:element name="Encryptio nRequirements" type="mstns:Enc ryptionEnum" />
<xs:element name="Authenica tionRequirement sRequired"
type="mstns:Aut henicationEnum" />
<xs:element name="Authenica tionRequirement sAllowed"
type="mstns:Aut henicationEnum" />
<xs:element name="KeepAlive Interval" type="xs:unsign edInt" default="5" />
<xs:element name="KeepAlive Units" type="KeepAlive UnitsType"
default="Minute s" />
</xs:sequence>
</xs:complexType>

OLD C# Code

[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s",
typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any",
typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName",
typeof(string))]

[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;

/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
public AddressTypeChoi ceWithAny ItemElementName ; <------------ see
this line below

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

NEW C# Code

[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {

/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s",
typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any",
typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName",
typeof(string))]

[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;

/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
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 AddressTypeChoi ceWithAny?

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
480
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 variation of a design pattern called "generation gap". In particular, there is library code that knows about certain classes that are user customized and generated with those customizations on behalf of the user. This is done via "opaque"...
12
2612
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 an embedded environment with multiple processors. I created a policy for classes, which, I had hoped, would automatically register the class with the appropriate factory: // In some header file... #include <cassert>
25
11093
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 keep the single users. My question is, how do I get the "Id"-value of a newly inserted address to store it in the referencing user table:
30
10929
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 from processes I've written over a TCP connection. My processes are all written in C; his are all done in Java. He's new to Java, and I've never really used it. My input is basically a stream of 32-bit unsigned integers (e.g., the
3
1345
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 side, etc. Some of the pages will be ASP.NET, some will be static HTML. 1. Is there any way to make sure that all the
10
3437
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 somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
4
2119
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) and the Language Objects Library) that I have converted over to C#. It works okay. However, in the C# version, one has to build the class library into the generated application, because I haven't structured this one thing right. I would like to...
0
1154
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 tool to parse the generated Reference.cs files to point to the shared types. For VS 2005, we have a SchemaImporterExtension. Some of the shared types are derived from other shared types. We can filter out these derived classes, but their parent...
9
1488
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 the connection, transaction, command and parameters required to invoke a stored procedure on our SQL Server database. It provides helper methods that simplify the process of invoking the stored procedure so that our data access classes can make the...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8535
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.