473,397 Members | 2,033 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,397 software developers and data experts.

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 <Questionelements 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
FormQuestionQuestionGroupQuestion for <Questionelement defined under
<QuestionGroup>.

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

<QuestionList>
<Question>
<QuestionGroup>
<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 2746
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 <Questionelements 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
FormQuestionQuestionGroupQuestion for <Questionelement defined under
<QuestionGroup>.

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

<QuestionList>
<Question>
<QuestionGroup>
<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
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...
0
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...
23
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? ...
10
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...
4
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
4
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. ...
9
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...
4
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...
11
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...
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
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,...
0
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...

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.