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

Programmatically generate xsd from a type

Hi,

I would like to generate an xml schema based upon a class, just as you can
do with xsd.exe (xsd.exe /type: typename /outputdir:c:\ assmeblyname). Is
there a way to do this by code instead of using this tool?
Thanks in advance.
Nov 12 '05 #1
3 5097
I was convinced I'd seen a reference to xsd using some internal classes to
this (that is it is just a wrapper). But I could not find it anywhere in
MSDN (does not mean it is not there!).

But I found this.

http://weblogs.asp.net/cazzu/archive.../24/33302.aspx

XmlSchemaExporter seems to the key thing here, but I have no idea what to do
with it. Please report back if you work it out!

Iain
"Bert" <no@thanks.com> wrote in message
news:Xn***********************@195.130.132.70...
Hi,

I would like to generate an xml schema based upon a class, just as you can
do with xsd.exe (xsd.exe /type: typename /outputdir:c:\ assmeblyname). Is
there a way to do this by code instead of using this tool?
Thanks in advance.

Nov 12 '05 #2
Thanks for your answer.

I've tried to figure out these classes, but while I'm not shure what they
do, they aren't what I'm looking for. You have to give an XmlSchema in
their constructors, and I want to generate XmlSchemas.

Any other ideas?

Bert.

"Iain" <id********@dircon.co.uk> wrote in
news:uG**************@tk2msftngp13.phx.gbl:
I was convinced I'd seen a reference to xsd using some internal
classes to this (that is it is just a wrapper). But I could not find
it anywhere in MSDN (does not mean it is not there!).

But I found this.

http://weblogs.asp.net/cazzu/archive.../24/33302.aspx

XmlSchemaExporter seems to the key thing here, but I have no idea what
to do with it. Please report back if you work it out!

Iain

Nov 12 '05 #3
Well you could obviously do it the 'hard' way using reflection.

For a give class simply enumerate the (public) properties, get their types
and write out an xsd based on that.

You may need to make it recursive.

But there MUST be a way ofdoing this in DOTNET already. I just can't find
it!

Iain

"Bert" <no@thanks.com> wrote in message
news:Xn*************************@195.130.132.70...
Thanks for your answer.

I've tried to figure out these classes, but while I'm not shure what they
do, they aren't what I'm looking for. You have to give an XmlSchema in
their constructors, and I want to generate XmlSchemas.

Any other ideas?

Bert.

"Iain" <id********@dircon.co.uk> wrote in
news:uG**************@tk2msftngp13.phx.gbl:
I was convinced I'd seen a reference to xsd using some internal
classes to this (that is it is just a wrapper). But I could not find
it anywhere in MSDN (does not mean it is not there!).

But I found this.

http://weblogs.asp.net/cazzu/archive.../24/33302.aspx

XmlSchemaExporter seems to the key thing here, but I have no idea what
to do with it. Please report back if you work it out!

Iain

Nov 12 '05 #4

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

Similar topics

6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
5
by: Ed | last post by:
Hi there, I have a very specific problem and hopefully there is a solution out there for me. I have a folder with thousands of Excel documents. Each of these documents has a header with the...
6
by: Null Reference | last post by:
Anybody here who can explain or point me to a link ? I wish to create a blank MS Access DB file programmatically using C# . Thanks, nfs
5
by: Carlo Marchesoni | last post by:
From an aspx page (A.aspx) I open another one (B.aspx - for table lookup). When the user selects an entry in B.aspx I would like to force a button's event in A.aspx to be fired. I guess the only...
1
by: Arpan | last post by:
The following ASPX code snippet creates a DataSet programmatically right from the scratch: 'create an empty DataSet Dim objDS As New DataSet("MyDataSet") 'create a new table & add columns Dim...
2
by: jjack100 | last post by:
In asp.net 2.0 you can apply custom themes based on a user profile, etc. And you can change the theme programmatically, etc. But how do you edit or create a theme programmatically? I am working on...
2
by: Thu | last post by:
I store me reporting data in MS Access table, and I need to programmatically generate XML file (in text) that loads these data, include all these data with appropriate definition, i.e. root,...
0
by: Ramesh2006 | last post by:
Hi, The following error occurred when i programmatically compile another project from my present project. The Error: error CS0234:The type or namespace name 'Windows' does not exist in the...
3
by: Ken Fine | last post by:
I'm interested in programmatically manipulating groups of ASP.NET controls by type. Can someone suggest code for the following? Loop through, say, all label controls on a page, and assigning a...
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: 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...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.