473,666 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dataset Schema from XSD

MR
Is there a way to load an XML schema into a dataset from a resource or other
object? I am using ReadXmlSchema(f ilename) and that works fine.
However, I have many XSD files that I would rather not have to distribute
with the application.
I would like to be able to use a typed dataset since the schema is defined
in advance.
Is this possible?
thanks
Nov 17 '05 #1
3 5618
Yes this is possible.

You can compile them at runtime and then make your application smart enough
that it doesn't recompile the same XSD twice.

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
----------------------------------------------------------------------------

"MR" <co******@newsg roup.nospam> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl...
Is there a way to load an XML schema into a dataset from a resource or
other object? I am using ReadXmlSchema(f ilename) and that works fine.
However, I have many XSD files that I would rather not have to distribute
with the application.
I would like to be able to use a typed dataset since the schema is defined
in advance.
Is this possible?
thanks

Nov 17 '05 #2
Thanks for Sahil's good suggestion.

Hi MR,

For typed DataSEt, of course they can be precompiled into assembly, we can
create TypedDataSet through a XSD in VS.NET and after compiled the
typeddataset's class will exisitng in the output assembly.
Also, if you think using un-typed dataset and load schema dynamically is
ok, we can embed the schema's xml file into our application's resources
(embeded in the assembly). then, the
System.Reflecti on.Assembly.Get ManifestResourc eStream method can help us
retrieve embeded file stream from assemlby's resource collection:

#Assembly.GetMa nifestResourceS tream Method
http://msdn.microsoft.com/library/en...ReflectionAsse
mblyClassGetMan ifestResourceSt reamTopic.asp?f rame=true

Hope also helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Sahil Malik [MVP]" <co************ *****@nospam.co m>
| References: <up************ **@TK2MSFTNGP10 .phx.gbl>
| Subject: Re: Dataset Schema from XSD
| Date: Sun, 7 Aug 2005 01:06:36 -0400
| Lines: 25
| Organization: dotnetawaremonk ey
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Response
| Message-ID: <uk************ *@TK2MSFTNGP15. phx.gbl>
| Newsgroups:
microsoft.publi c.data.ado,micr osoft.public.do tnet.framework. adonet,microsof t
..public.dotnet .languages.csha rp
| NNTP-Posting-Host: pool-138-88-231-157.res.east.ve rizon.net 138.88.231.157
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.adonet:3358 2
microsoft.publi c.dotnet.langua ges.csharp:1147 23
microsoft.publi c.data.ado:6667
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Yes this is possible.
|
| You can compile them at runtime and then make your application smart
enough
| that it doesn't recompile the same XSD twice.
|
| - Sahil Malik [MVP]
| ADO.NET 2.0 book -
| http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
|
----------------------------------------------------------------------------
|
|
|
| "MR" <co******@newsg roup.nospam> wrote in message
| news:up******** ******@TK2MSFTN GP10.phx.gbl...
| > Is there a way to load an XML schema into a dataset from a resource or
| > other object? I am using ReadXmlSchema(f ilename) and that works fine.
| > However, I have many XSD files that I would rather not have to
distribute
| > with the application.
| > I would like to be able to use a typed dataset since the schema is
defined
| > in advance.
| > Is this possible?
| > thanks
| >
|
|
|

Nov 17 '05 #3
Hi MR,

Have you had a chance to lookup the suggestions in the former messages or
have you got any further ideas on this issue? If there're anything else we
can help, please feel free to post here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 108746306
| References: <up************ **@TK2MSFTNGP10 .phx.gbl>
<uk************ *@TK2MSFTNGP15. phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 08 Aug 2005 07:24:36 GMT
| Subject: Re: Dataset Schema from XSD
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| Message-ID: <tM************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Lines: 73
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.langua ges.csharp:1148 57
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Thanks for Sahil's good suggestion.
|
| Hi MR,
|
| For typed DataSEt, of course they can be precompiled into assembly, we
can
| create TypedDataSet through a XSD in VS.NET and after compiled the
| typeddataset's class will exisitng in the output assembly.
| Also, if you think using un-typed dataset and load schema dynamically is
| ok, we can embed the schema's xml file into our application's resources
| (embeded in the assembly). then, the
| System.Reflecti on.Assembly.Get ManifestResourc eStream method can help us
| retrieve embeded file stream from assemlby's resource collection:
|
| #Assembly.GetMa nifestResourceS tream Method
|
http://msdn.microsoft.com/library/en...ReflectionAsse
| mblyClassGetMan ifestResourceSt reamTopic.asp?f rame=true
|
| Hope also helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | From: "Sahil Malik [MVP]" <co************ *****@nospam.co m>
| | References: <up************ **@TK2MSFTNGP10 .phx.gbl>
| | Subject: Re: Dataset Schema from XSD
| | Date: Sun, 7 Aug 2005 01:06:36 -0400
| | Lines: 25
| | Organization: dotnetawaremonk ey
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | X-RFC2646: Format=Flowed; Response
| | Message-ID: <uk************ *@TK2MSFTNGP15. phx.gbl>
| | Newsgroups:
|
microsoft.publi c.data.ado,micr osoft.public.do tnet.framework. adonet,microsof t
| .public.dotnet. languages.cshar p
| | NNTP-Posting-Host: pool-138-88-231-157.res.east.ve rizon.net
138.88.231.157
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.framew ork.adonet:3358 2
| microsoft.publi c.dotnet.langua ges.csharp:1147 23
| microsoft.publi c.data.ado:6667
| | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
| |
| | Yes this is possible.
| |
| | You can compile them at runtime and then make your application smart
| enough
| | that it doesn't recompile the same XSD twice.
| |
| | - Sahil Malik [MVP]
| | ADO.NET 2.0 book -
| | http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
| |
|
----------------------------------------------------------------------------
| |
| |
| |
| | "MR" <co******@newsg roup.nospam> wrote in message
| | news:up******** ******@TK2MSFTN GP10.phx.gbl...
| | > Is there a way to load an XML schema into a dataset from a resource
or
| | > other object? I am using ReadXmlSchema(f ilename) and that works fine.
| | > However, I have many XSD files that I would rather not have to
| distribute
| | > with the application.
| | > I would like to be able to use a typed dataset since the schema is
| defined
| | > in advance.
| | > Is this possible?
| | > thanks
| | >
| |
| |
| |
|
|

Nov 17 '05 #4

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

Similar topics

1
5320
by: harry | last post by:
Hello, not certain if this should go here or ado.net but I'm trying to create an XSD on the fly (due to the fact that our dataaccess component is a legacy component which returns data in an xml format) Now I can create all of the schema using the .Net frameworks class except for being able to add the msdata:isDataSet="true"
3
10284
by: Joe98765 | last post by:
I have data coming from SQL Server and need to write out some XML. I have a schema(xsd) for this XML file. Right now I am bringing in the DataSet and writing out the elements and attributes myself using xmltextwriter to match schema without really using the xsd at the time of writing. The file I create validates but I was wondering is there a better way? I see things like inferschema method off of dataset, can this be used? How do you...
0
3079
by: Patrick Kearney | last post by:
Hi All, I have seen this type of question raised in various groups but no one has supplied a definitive answer. I am trying to load a dataset schema that has an xs:include. Project policy is to have all schemas as embedded resources but there appears to be no means by which the DataSet.ReadXmlSchema method can be induced to use a custom Xmlresolver in order to supply the embedded referenced schema. I have tried passing a custom resolver to...
7
6221
by: Sharon | last post by:
I have successfully loaded a DataSet object with a XML schema (XSD). Now I wish to populate the tables that was created in the DataSet. I have an XML file/string that contain all the needed data in the same format as the XSD (the XML file/string was created using this same schema). The XML file/string may contain data for a single table or for several tables at once. The question is:
4
1874
by: Sindarian | last post by:
This just seems like the most basic thing, but I can't find a simple description of this process anywhere and in here, everone is talking about going the other way :( I had .NET create an XML Schema file (xsd) for a table in my database. I then create a DataSet that contains 1 row of data from that same table. I want to use this DataSet along with the Schema file to create an XML file that ACTUALLY CONTAINS THE DATA. Simple huh: DataSet +...
0
1694
by: c.w.browne | last post by:
Hi, Ive had a bit of a look around for other people with this problem and cant find anything that solves it in my case, so I'm afraid im going to have to bother you all with a post of my own. Essentially, I am trying to read in an xml schema and then an xml document into a dataset using ReadXmlSchema and then ReadXml. When i do this, i end up with a table in the dataset (which i assume is created when i read the schema), but no rows...
1
3627
by: Mac | last post by:
I'm trying to validate input from an xml source to a dataset in dotnet2.0. As far as I can see, type errors correctly cause an exception, but values that are the correct type but do not satisify xsd:restriction conditions are ingested without a murmur. Is this a bug or a feature? Very frustrating. Evidence: 1) XML data <?xml version="1.0" encoding="utf-8"?>
13
2346
by: Maxwell2006 | last post by:
Hi, We are having a debate over using DataSet as return value type for web services. The problem is that we don't know whether Java applications can use DataSet
2
4690
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two tables in one call. I'm using Microsoft EnterpriseLibrary for Data to get the data from SP. It works fine and I get two tables in the dataset, "Table1" and "Table2". I then have an XML-file, which will serve as a template to generate the XML-schema,...
0
2031
by: =?Utf-8?B?TGFzdGJ1aWxkZXJz?= | last post by:
Hi all, I have a weird problem which has been causing me a headache for the last two days. I have to dynamicly generate a schema in memory and load it into a dataset in memory to be returned for further use. To create the schema I am using the XMLSchema classes and the result is the
0
8440
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
8352
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
8863
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...
0
8780
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...
0
8636
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
4192
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...
1
2765
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 we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
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.