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

Question about ReadXMLSchema...

JG
Hi,

I have a quick question regarding the proper use of ReadXmlSchema. For
example I have the following code.

DataSet ds = new DataSet();
ds.ReadXmlSchema("c:\\XMLInputFile.xsd");

I was doing some searches on the web and found this version:

DataSet ds = new DataSet();
FileStream fsSchema = new FileStream("c:\\XMLInputFile.xsd", FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
ds.ReadXmlSchema(fsSchema);
fsSchema.Close();

My question is this: is there an advantage in using the filestream as
opposed to just using the filename as in my original example? I am just
trying to figure this out...

Any info would be highly appreciated...

thanks,
joe
Nov 16 '05 #1
1 3403
The methods are essentially doing the same thing, however with the second
example you are increasing your control over the filestream and what you do
with it. For example what happens if the filepath does not exist. An
exception would be thrown at the filestream wheras with your example a
FileNotFound exception would be thrown from the DataSet.

Both are valid methods though so I wouldn't get too hung up about either
way.

Br,

Mark.
"JG" <NoSpam> wrote in message news:Oa**************@TK2MSFTNGP11.phx.gbl...
Hi,

I have a quick question regarding the proper use of ReadXmlSchema. For
example I have the following code.

DataSet ds = new DataSet();
ds.ReadXmlSchema("c:\\XMLInputFile.xsd");

I was doing some searches on the web and found this version:

DataSet ds = new DataSet();
FileStream fsSchema = new FileStream("c:\\XMLInputFile.xsd",
FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
ds.ReadXmlSchema(fsSchema);
fsSchema.Close();

My question is this: is there an advantage in using the filestream as
opposed to just using the filename as in my original example? I am just
trying to figure this out...

Any info would be highly appreciated...

thanks,
joe

Nov 16 '05 #2

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

Similar topics

11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
0
by: Pete | last post by:
I am trying to load a DataSet from an xml file that has 2 tables in it. Any help would be great. Here is the C# code snipit on how I load it. Instead of geting a dataset with 2 table I am...
0
by: Greg | last post by:
I'm trying to use the ReadXmlSchema method of the DataSet class from behind a firewall/proxy server and can't get it to work. I can run the code on a machine not behind the firewall and it works...
0
by: Eric van Wijk | last post by:
Hi, When I try to assign a schema to a dataset using the ReadXmlSchema method, that schema does not import any schemas included with xs:import. Both schema's are stored in the assembly as...
1
by: Tarun Upadhyay | last post by:
I am trying to read the standard UDDI schema using a DataSet. however, it always chokes with error. Here are the full details: Schema used: http://uddi.org/schema/uddi_v3.xsd C# (.NET) calls...
0
by: Tim Nelson | last post by:
I've got an XML document I am loading into a dataset using ..ReadXml/.ReadXmlSchema. The dataset looks perfect and I can bind it to a datagrid and elements appear as tables and attributes appear...
0
by: Justin | last post by:
Greetings All, I'm trying to use the ReadXmlSchema method to define a DataSet before using the ReadXml method, and am receiving the following error: Type...
13
by: Jerry C | last post by:
I am using some sample code from gotdotnet to Create DataSet mappings from a xsd schema. I am geting this error. code and error below. I might mention there is also a publictypelibrary file with...
2
by: Sambo | last post by:
Hi All I've had a look around and noticed a couple of others having this issue, but with no replies. Hopefully someone can help with this. I have a schema (let's call it "Schema1.xsd") that I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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...
0
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
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
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,...
0
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...

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.