473,597 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsd.exe: How to add base class to generated classes

I'd like to generate C# classes from an XML Schema file. All the generated
classes should provide a basic member function framework like Save() and a
basic member element like Dirty. Moreover, I'd like to have all the
generated class properties overwritten so that a write will set the Dirty
member to true (see example below).

Is this possible using xsd.exe? Or is there some other way? Or do I need to
write my own generator tool?

Thanks for enlightening me!

TIA,
Axel Dahmen
-----------------------------------------------------------
class GeneratedClass : BaseClass
{
private int member_;

public int Member {
get {return member_;}

// this function references base class members...
set {member_=value; State=Updated;}
}
}
/// This class will be provided in another file.
/// It provides basic funtionality common to all generated classes
class BaseClass
{
protected enum StateEnum {Inserted,Delet ed,Updated,Clea n};
protected State;

public virtual Save(); // uses Reflection to save derived classes
}
Nov 12 '05 #1
1 3506
Hi Axel

If your having problems with XSD.exe, then I suggest you look at Liquid
XML

http://www.liquid-technologies.com/

It supports C#, java, C++ & Visual Basic. It also supports more of the
XSD standard than xsd.exe, and may other the other tools out there.

Regards

Simon

Axel Dahmen wrote:
I'd like to generate C# classes from an XML Schema file. All the generated
classes should provide a basic member function framework like Save() and a
basic member element like Dirty. Moreover, I'd like to have all the
generated class properties overwritten so that a write will set the Dirty
member to true (see example below).

Is this possible using xsd.exe? Or is there some other way? Or do I need to
write my own generator tool?

Thanks for enlightening me!

TIA,
Axel Dahmen
-----------------------------------------------------------
class GeneratedClass : BaseClass
{
private int member_;

public int Member {
get {return member_;}

// this function references base class members...
set {member_=value; State=Updated;}
}
}
/// This class will be provided in another file.
/// It provides basic funtionality common to all generated classes
class BaseClass
{
protected enum StateEnum {Inserted,Delet ed,Updated,Clea n};
protected State;

public virtual Save(); // uses Reflection to save derived classes
}


Nov 12 '05 #2

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

Similar topics

2
32286
by: Marek | last post by:
Actually, the very first question I should ask is "does it make sense at all?". For 2 days I've been trying to generate C# classes using XML schema and xsd.exe tool. So far the results are not exciting but I assume I am seriously short of knowledge, so here I am - asking for help. My current situation is that I can define schemas that will generate very simple classes but I have two major problems: (1) I do not know how to write a...
0
3020
by: keith bannister via .NET 247 | last post by:
(Type your message here) -------------------------------- From: keith bannister Hi, I'm new to .net (as of last week) but here goes. I want to serialize/deserialize a file the conforms to an XML schema (xsd).
5
7278
by: Keith Bannister | last post by:
I'm new to .net so here goes. I'm tying to deserialize a class that is associated with an XML schema. I created the C# class with xsd.exe as below: xsd.exe /c /n:somenamespace properties.xsd this creates properties.cs
3
4440
by: Bobby | last post by:
I have a schema and have used XSDObjectGen.exe to create a set of classes that represent the schema. What is the best way to fill xsdobjectgen.exe generated classes with data? I want to create and serialize an instance of one of the classes in this schema. the class is declared publicly, but isn't accessible outside the namespace: ...
5
3480
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices by adding a WebReference, since it does not allow me to keep state (cookiecontainer) or to specify functions on the classes (like if i want to override the ToString() function on a class from my webservice). So the only way i can see how i can get...
9
3814
by: Developer | last post by:
Hi, How can one tell wsdl.exe/VS.NET web service proxy generatioon to to put on imported classes? For example, i fin your web service you use a class: class Data { }
1
440
by: Axel Dahmen | last post by:
I'd like to generate C# classes from an XML Schema file. All the generated classes should provide a basic member function framework like Save() and a basic member element like Dirty. Moreover, I'd like to have all the generated class properties overwritten so that a write will set the Dirty member to true (see example below). Is this possible using xsd.exe? Or is there some other way? Or do I need to write my own generator tool? ...
26
5348
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is because I am not always able to control/create all the different constructors the base class has. My problem can be described in code as follows ... /* This is the base class with a whole heap of constructors/functionality*/ public class Animal
0
1620
by: greenstone | last post by:
Hi, I am trying to figure out how to get XSD.EXE (when generating C# classes from an .xsd) to add the XmlArrayItemAttribute Deserization Annotations to my C# generated class output: My specific case is when the .xsd has an element that holds an array of substitutionGroup'ed items. Following is an example of a matching set of xsd, xml, xsd.exe command to generate C#, and the output C#. When running a unit-test on the C#, the...
0
7965
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
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
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
8258
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
6686
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...
1
5847
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
5426
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
3881
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
1231
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.