Connecting Tech Pros Worldwide Forums | Help | Site Map

Dataset Schema from XSD

MR
Guest
 
Posts: n/a
#1: Nov 17 '05
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



Sahil Malik [MVP]
Guest
 
Posts: n/a
#2: Nov 17 '05

re: Dataset Schema from XSD


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" <comconix@newsgroup.nospam> wrote in message
news:uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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
>[/color]


Steven Cheng[MSFT]
Guest
 
Posts: n/a
#3: Nov 17 '05

re: Dataset Schema from XSD


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

#Assembly.GetManifestResourceStream Method
http://msdn.microsoft.com/library/en...ReflectionAsse
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]" <contactmethrumyblog@nospam.com>
| References: <uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl>
| 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: <ukXMK3wmFHA.544@TK2MSFTNGP15.phx.gbl>
| 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!TK2MSFT NGP15.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.ma.../13/63199.aspx
|
----------------------------------------------------------------------------
|
|
|
| "MR" <comconix@newsgroup.nospam> wrote in message
| news:uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl...
| > 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
| >
|
|
|

Steven Cheng[MSFT]
Guest
 
Posts: n/a
#4: Nov 17 '05

re: Dataset Schema from XSD


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: <uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl>
<ukXMK3wmFHA.544@TK2MSFTNGP15.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: stcheng@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.public.dotnet.languages.csharp
| Message-ID: <tMuWEp#mFHA.3672@TK2MSFTNGXA01.phx.gbl>
| 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.GetManifestResourceStre am method can help us
| retrieve embeded file stream from assemlby's resource collection:
|
| #Assembly.GetManifestResourceStream Method
|
http://msdn.microsoft.com/library/en...ReflectionAsse
| 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]" <contactmethrumyblog@nospam.com>
| | References: <uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl>
| | 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: <ukXMK3wmFHA.544@TK2MSFTNGP15.phx.gbl>
| | 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!TK2MSFT NGP15.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.ma.../13/63199.aspx
| |
|
----------------------------------------------------------------------------
| |
| |
| |
| | "MR" <comconix@newsgroup.nospam> wrote in message
| | news:uphNG8rmFHA.3552@TK2MSFTNGP10.phx.gbl...
| | > 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
| | >
| |
| |
| |
|
|

Closed Thread