Dataset Schema from XSD

M

MR

Is there a way to load an XML schema into a dataset from a resource or other
object? I am using ReadXmlSchema(filename) 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
 
S

Steven Cheng[MSFT]

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.Reflection.Assembly.GetManifestResourceStream method can help us
retrieve embeded file stream from assemlby's resource collection:

#Assembly.GetManifestResourceStream Method
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemReflectionAsse
mblyClassGetManifestResourceStreamTopic.asp?frame=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]" <[email protected]>
| References: <[email protected]>
| Subject: Re: Dataset Schema from XSD
| Date: Sun, 7 Aug 2005 01:06:36 -0400
| Lines: 25
| Organization: dotnetawaremonkey
| 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: <[email protected]>
| Newsgroups:
microsoft.public.data.ado,microsoft.public.dotnet.framework.adonet,microsoft
..public.dotnet.languages.csharp
| NNTP-Posting-Host: pool-138-88-231-157.res.east.verizon.net 138.88.231.157
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.adonet:33582
microsoft.public.dotnet.languages.csharp:114723
microsoft.public.data.ado:6667
| X-Tomcat-NG: microsoft.public.dotnet.languages.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.malik/archive/2005/05/13/63199.aspx
|
----------------------------------------------------------------------------
|
|
|
| | > Is there a way to load an XML schema into a dataset from a resource or
| > other object? I am using ReadXmlSchema(filename) 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
| >
|
|
|
 
S

Steven Cheng[MSFT]

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: <[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 08 Aug 2005 07:24:36 GMT
| Subject: Re: Dataset Schema from XSD
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| Message-ID: <tMuWEp#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Lines: 73
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.languages.csharp:114857
| 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.Reflection.Assembly.GetManifestResourceStream method can help us
| retrieve embeded file stream from assemlby's resource collection:
|
| #Assembly.GetManifestResourceStream Method
|
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemReflectionAsse
| mblyClassGetManifestResourceStreamTopic.asp?frame=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]" <[email protected]>
| | References: <[email protected]>
| | Subject: Re: Dataset Schema from XSD
| | Date: Sun, 7 Aug 2005 01:06:36 -0400
| | Lines: 25
| | Organization: dotnetawaremonkey
| | 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: <[email protected]>
| | Newsgroups:
|
microsoft.public.data.ado,microsoft.public.dotnet.framework.adonet,microsoft
| .public.dotnet.languages.csharp
| | NNTP-Posting-Host: pool-138-88-231-157.res.east.verizon.net
138.88.231.157
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.adonet:33582
| microsoft.public.dotnet.languages.csharp:114723
| microsoft.public.data.ado:6667
| | X-Tomcat-NG: microsoft.public.dotnet.languages.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.malik/archive/2005/05/13/63199.aspx
| |
|
----------------------------------------------------------------------------
| |
| |
| |
| | | | > Is there a way to load an XML schema into a dataset from a resource
or
| | > other object? I am using ReadXmlSchema(filename) 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
| | >
| |
| |
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top