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

Problem with loading XML file in VB.NET 2003

Hi All,

I am using VB.NET 2003 and having problems with loading an xml file. Here's
my code:

Public Sub LoadXML()
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("C:\Databases.xml")

'more code follows here

End Sub

When I get to the line that loads the databases.xml file, I get this error
message:

An unhandled exception of type 'System.NotSupportedException' occurred in
system.xml.dll
Additional information: FileStream was asked to open a device that was not a
file. FileStream's constructors that take a String will only work with
devices that are really files. If you need support for devices like "com1:"
or "lpt1:", then call CreateFile yourself then use the FileStream
constructors that take an OS handle as an IntPtr.

Any ideas why? the file C:\Databases.xml does exist.

--
Thank you in advance.

Vergel Adriano
May 15 '07 #1
3 2520
On May 15, 2:18 pm, Vergel Adriano
<VergelAdri...@discussions.microsoft.comwrote:
Hi All,

I am using VB.NET 2003 and having problems with loading an xml file. Here's
my code:

Public Sub LoadXML()
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("C:\Databases.xml")

'more code follows here

End Sub

When I get to the line that loads the databases.xml file, I get this error
message:

An unhandled exception of type 'System.NotSupportedException' occurred in
system.xml.dll
Additional information: FileStream was asked to open a device that was not a
file. FileStream's constructors that take a String will only work with
devices that are really files. If you need support for devices like "com1:"
or "lpt1:", then call CreateFile yourself then use the FileStream
constructors that take an OS handle as an IntPtr.

Any ideas why? the file C:\Databases.xml does exist.

--
Thank you in advance.

Vergel Adriano
Any ideas why? the file C:\Databases.xml does exist.
Does it open fine with internet explorer? Also, can you load other Xml
files in this same application?

Thanks,

Seth Rowe

May 15 '07 #2
On May 15, 2:18 pm, Vergel Adriano
<VergelAdri...@discussions.microsoft.comwrote:
Hi All,

I am using VB.NET 2003 and having problems with loading an xml file. Here's
my code:

Public Sub LoadXML()
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("C:\Databases.xml")

'more code follows here

End Sub

When I get to the line that loads the databases.xml file, I get this error
message:

An unhandled exception of type 'System.NotSupportedException' occurred in
system.xml.dll
Additional information: FileStream was asked to open a device that was not a
file. FileStream's constructors that take a String will only work with
devices that are really files. If you need support for devices like "com1:"
or "lpt1:", then call CreateFile yourself then use the FileStream
constructors that take an OS handle as an IntPtr.

Any ideas why? the file C:\Databases.xml does exist.

--
Thank you in advance.

Vergel Adriano
The help text says that the overloaded Load method that takes a
character string as the parameter must be a URL. I belive that is
different from a file path. At any rate, I have successfully loaded
XML files using the overloaded Load method that takes a FileStream as
the parameter. Of course, you have to initialize the FileStream to the
XML file to open first.

May 15 '07 #3
Thank you, Seth and zacks for your responses. I tried my code in a different
computer and it worked. I might just try re-installing the .NET framework
and Studio on the other computer and see how it goes.

Thanks again.

Vergel Adriano
"za***@construction-imaging.com" wrote:
On May 15, 2:18 pm, Vergel Adriano
<VergelAdri...@discussions.microsoft.comwrote:
Hi All,

I am using VB.NET 2003 and having problems with loading an xml file. Here's
my code:

Public Sub LoadXML()
Dim xmlDoc As New Xml.XmlDocument
xmlDoc.Load("C:\Databases.xml")

'more code follows here

End Sub

When I get to the line that loads the databases.xml file, I get this error
message:

An unhandled exception of type 'System.NotSupportedException' occurred in
system.xml.dll
Additional information: FileStream was asked to open a device that was not a
file. FileStream's constructors that take a String will only work with
devices that are really files. If you need support for devices like "com1:"
or "lpt1:", then call CreateFile yourself then use the FileStream
constructors that take an OS handle as an IntPtr.

Any ideas why? the file C:\Databases.xml does exist.

--
Thank you in advance.

Vergel Adriano

The help text says that the overloaded Load method that takes a
character string as the parameter must be a URL. I belive that is
different from a file path. At any rate, I have successfully loaded
XML files using the overloaded Load method that takes a FileStream as
the parameter. Of course, you have to initialize the FileStream to the
XML file to open first.

May 16 '07 #4

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

Similar topics

1
by: Joe | last post by:
Hi Does anyone know of any issues about loading config files for windows forms applications? I have an application that utilizes a config file that holds my database connection string as well...
0
by: Bill | last post by:
Hi Everyone, I am having some difficulty in using the Windows Resource Localization Editor (WinRes.exe) on several Visual Basic .NET forms (.resx files) in two different projects. The editor...
0
by: Deep Purple | last post by:
I started with the following error... ------------------------------------------------------- An error occured while loading the schema with TargetNamespace 'http://www.w3.org/2001/XMLSchema'...
9
by: tym | last post by:
HELP!!! I'm going round the twist with this... I have a VB6 application which is using DAO to access a database (Please - no lectures on ADO, I know what I'm doing with DAO!!) Ok, problem...
0
by: Roy Chastain | last post by:
I have a simple page or two and a simple global.asax file that loads some configuration from the web.config file. I developed this on a Windows XP box with framework version 1.1 installed. I run...
2
by: Rob | last post by:
I was working on a project and everything was going fine, then all of a sudden the form set as my startup object stopped loading. I tried setting some others as the startup object, and some of my...
3
by: f1racing24 | last post by:
I am trying to compile this class in the command-line and this error comes up 'Start -> C:\Inetpub\wwwroot\DCReview_Brinkster\code>vbc /t:library /verbose...
3
by: Doug | last post by:
I'm having problems w/ the VS2005 debugger with C#. It blows past any breakpoints in even the simplest "Hello World" console application. I can't do any step-by-step debugging. I've provided the...
4
Fary4u
by: Fary4u | last post by:
Hi i've found this problem for a long time but i thought i can live wd this but now it's giving me headack it's mostly happend when u got some problem on the network , after installation...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.