473,491 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Generating XSD file dynamically.

Hi all,

Can anyone tell me how to generate xsd file dynamically for datatable.
And then how to create datatable from that dynamically generated xsd
file.

I want to generate datatable from this dynamically generated xsd file.

Can anyone tell how to do this? means how to generate xsd file
dynamically with for some column default value. and then how to
generate datatable from that xsd file.

any help will be truely appreciated.

Feb 22 '07 #1
1 12989
Hi Archana,
This is how I create xsd from visual studio 2003 using ADO. Ive not tried to
create table from xsd in reverse so cant help u there.

Pseudo Code

In form
DataSet ds = databasehandler.CreateMyDataset();

In databasehandler
private DataSet CreateMyDataset()
{
string sql = "SELECT SOME RECORDS"
IDbConnection Connection = GetConnection() (GetConnection opens database
with connection strings etc)
DataSet result = new DataSet();
IDbDataAdapter Adapter = new SqlDataAdapter();
IDbCommand command = Connection.CreateCommand();
command.CommandText = sql;
Adapter.SelectCommand.= command;
Adapter.Fill(result);
return result;
}

form now has a filled dataset
databasehandler.WriteXSDSchema(ds,"MyDataset.xml") ;

Back to databasehandler for writing schema. Make sure that xsd.exe is in the
same directory as your main application or is in %path%
Following creates xsd file from dataset
public void WriteXSDSchema(DataSet ds, string xmlfilename)
{
#region WriteXSDSchema
// Write the schema to xml file
ds.WriteXmlSchema(xmlfilename);
try
{
// convert xml to xsd. xsd.exe should be in output path
if (File.Exists("xsd.exe"))
{
Process p = Process.Start("xsd.exe",xmlfilename);
if (p != null)
{
// Wait for it to exit then delete the xml file which isnt needed
p.WaitForExit(2000);
File.Delete(xmlfilename);
}
}
else
MessageBox.Show("xsd.exe is missing from application output path. This
function can not continue");
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
#endregion
}// function


Feb 22 '07 #2

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

Similar topics

1
2957
by: Jon | last post by:
I need to generate an XML File dynamically using ASP and a SQL Database. I don't have time to learn php or any other programing language. I need a ASP page to either append information to an XML...
1
1750
by: eddie wang | last post by:
How to move around a picture file dynamically in an asp page? Any link to sample code will be great. Thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate...
2
1718
by: Astra | last post by:
Hi All Creating an rss.xml file dynamically via ASP/ADO/DB, but find errors in the file. Don't think it's an ASP prob to be honest. Think its more to do with the fact that the ampersands are...
0
1313
by: orencs | last post by:
Hi, I have a small question in regards to Microsoft Practices Enterprise Library Common: I hope you could help because I have reached a dead end. Is there a way to load the configuration...
0
2490
by: harish139 | last post by:
hi, i want to create a xml file dynamically, that is i have 2 arrays, i want to run a program to fill that array, if the array size becomes 2KB i want to create a xml file like this ...
1
1877
by: harish139 | last post by:
hi, i want to create a xml file dynamically, that is i have 2 arrays, i want to run a program to fill that array, if the array size becomes 2KB i want to create a xml file like this ...
8
2327
by: miladhatam | last post by:
can i change the size of a file dynamically ? for example have 100 Kb and i want to decrease it to 20 Kb thanks
1
1146
by: mnvk | last post by:
Hi, I need to create a text file dynamically at a specified location when I run my console application. Thanks, mnv.
0
7115
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
6978
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...
0
7190
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
7360
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
5451
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,...
1
4881
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...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
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 ...
1
633
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.