473,802 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsd.exe duplicate class declaration

I generated a .cs class from a .xsd schema using the xsd.exe tool from Visual
Studio 2005 and noticed that is generating duplicate class declarations. This
happens because of my schema structure. I have an element, <QuestionList >,
that is a set of <Questionelemen ts that is defined at the root of the
schema and but it can also be defined as child of an element <QuestionGroup> .
The tool, instead of generation a class for the QuestionList element,
generates it twice, one for the root element (class FormQuestion) and a class
FormQuestionQue stionGroupQuest ion for <Questionelemen t defined under
<QuestionGroup> .

Here is a portion of a xml instance based on the xsd schema:

<QuestionList >
<Question>
<QuestionGrou p>
<QuestionList >
<Question>
....

xsd tool seems to generate classes as a string concatenation of the elements
throughout the schema hierarchy. Any way to avoid this class declaration
duplication?

Thanks
Miguel

Jul 24 '06 #1
1 2764
Problem solved. Problem was with the schema. I inferred the schema from a xml
file and Visual Studio 2005 generated it without complex types, duplicating
the elements definition. I edited the schema and generated complex types from
the elements (option Make Complex Type) and regenerated the class.

Thanks
Miguel

"Miguel Isidoro" wrote:
I generated a .cs class from a .xsd schema using the xsd.exe tool from Visual
Studio 2005 and noticed that is generating duplicate class declarations. This
happens because of my schema structure. I have an element, <QuestionList >,
that is a set of <Questionelemen ts that is defined at the root of the
schema and but it can also be defined as child of an element <QuestionGroup> .
The tool, instead of generation a class for the QuestionList element,
generates it twice, one for the root element (class FormQuestion) and a class
FormQuestionQue stionGroupQuest ion for <Questionelemen t defined under
<QuestionGroup> .

Here is a portion of a xml instance based on the xsd schema:

<QuestionList >
<Question>
<QuestionGrou p>
<QuestionList >
<Question>
....

xsd tool seems to generate classes as a string concatenation of the elements
throughout the schema hierarchy. Any way to avoid this class declaration
duplication?

Thanks
Miguel
Jul 24 '06 #2

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

Similar topics

7
2336
by: Lowell Kirsh | last post by:
I have a script which I use to find all duplicates of files within a given directory and all its subdirectories. It seems like it's longer than it needs to be but I can't figure out how to shorten it. Perhaps there are some python features or libraries I'm not taking advantage of. The way it works is that it puts references to all the files in a dictionary with file size being the key. The dictionary can hold multiple values per key....
0
948
by: Michelle Stone | last post by:
When I load a WebForm I created long back I get the following error message in my TASK 1. Duplicate declaration of member Locale (many such messages 2. The variable Parameters is either undeclared or was never assigne To make diagnosis strange, when I double click on the first task, i am taken to line number 1 of the corresponding source file. Very strange Double clicking on the second kind of tasks takes me to the SelectCommand...
23
3869
by: mark.moore | last post by:
I know this has been asked before, but I just can't find the answer in the sea of hits... How do you forward declare a class that is *not* paramaterized, but is based on a template class? Here's what I thought should work, but apparently doesn't: class Foo; void f1(Foo* p)
10
3492
by: 4MLA1FN | last post by:
i'm somewhat of a c++ newbie. i'm linking some static libraries into my app. it turns out that two of the libraries (from different suppliers) share a class name; e.g. they both have a class named 'SomeClass'. the compiler/linker is complaining. is there an easy way deal with this so my app can link? thanks.
4
8001
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
4
3410
by: whatnameisnottaken | last post by:
right now i have gotten all the classes to print out using helpdbg. Now i want to remove the duplicate class names out of an array so i can just print one of each. This is the output i have. class URopeBeamEmitter; class AAGP_GameInfo; class AAGP_Weapon; class ABaseScope; class AInfantryHUD; class UCamEffect_BlurOut; class URopeBeamEmitter;
9
8903
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've *defined* "x"'s value to be 10, isn't above statement a
4
5570
by: hamster | last post by:
Hi there Can anyone help.. Im getting this error : Duplicate declaration of member 'Location' and on my form all controls is on the left top corner. Is there anyway to fix this? When i run the program it looks ok, but once i make a change or try to then it stays that way. Im using VS2003 and C#.net thanks
11
4683
by: mdh | last post by:
I decided to make a single file containing all the repetitive functions in K&R so that I could concentrate on the new discussions. This went along just fine, and with each new function, added the declaration to foo.h and the function to foo.c. Then, on one compilation, I suddenly got a massive number of failures and warnings. Like "Redefinition errors. errors complaining about a variable not having been declared, when it was etc"
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
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
10285
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
10063
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...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5494
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...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.