473,386 Members | 1,867 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.

System.Xml.XmlException

Hi,
I am making a web application in Web Matrix on .NET framework.
I have a Login.aspx File and a Users.xml file.I am reading data
from Users.xml file using FileStream.The Code is

DataSet ds = new DataSet ( );

FileStream fs = new FileStream ( Server.MapPath ( "Users.xml"
),

FileMode.Open,FileAccess.Read );
StreamReader reader = new StreamReader ( fs );
ds.ReadXml ( reader );
reader.Close();
fs.Close ( );

it gives the following error :

System.Xml.XmlException: This is an unexpected token. Expected
'EndElement'. Line 10, position 5.

Where is the mistake in my code?

any Ideas???

Dec 23 '05 #1
1 2315
> Hi,
I am making a web application in Web Matrix on .NET framework.
I have a Login.aspx File and a Users.xml file.I am reading data
from Users.xml file using FileStream.The Code is

DataSet ds = new DataSet ( );

FileStream fs = new FileStream ( Server.MapPath ( "Users.xml"
),

FileMode.Open,FileAccess.Read );
StreamReader reader = new StreamReader ( fs );
ds.ReadXml ( reader );
reader.Close();
fs.Close ( );

it gives the following error :

System.Xml.XmlException: This is an unexpected token. Expected
'EndElement'. Line 10, position 5.

Where is the mistake in my code?

any Ideas???


The error seems to say the XML isn't formatted correctly.
Try opening it in IE, that might show you the error.

Apart from that, you could also use:
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath ( "Users.xml"));

(but this will fail on that same error, but maybe with a more helpful
message)

Hans Kesting
Dec 23 '05 #2

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

Similar topics

0
by: George CK | last post by:
Hello, I tried to send an xml string got from XmlTextReader from a web service proxy to a web service. The type of the web method is simply "string" It's fine when the string length was small...
3
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms....
0
by: Franck | last post by:
Hello, here is my basic dtd <!ELEMENT TREENODES (treenode*)> <!ELEMENT treenode (treenode*)> <!ATTLIST treenode Text (#PCDATA) #REQUIRED Level (#PCDATA) #REQUIRED NodeData (#PCDATA) ...
0
by: Frederico Guimar?es via DotNetMonster.com | last post by:
Hi, I'm trying to use the Microsoft.Web.Services2.Messaging. ISoapFormatter but I receive this error: System.Xml.XmlException: The root element is missing. at System.Xml.XmlTextReader.Read()...
1
by: marcmc | last post by:
The code is below but I'm 99.9% sure that the code is okay and that maybe the schema has become corrupt somehow and im not sure how to fix it? Private Function LoadXMLSchema() 'Dim fileName As...
0
by: Ramon de Klein | last post by:
I try to serialize an exception using the SoapFormatter, but this is a little bit problematic. The MethodInfo tag of the serialized exception contains &x00 characters (ASCII 0x00) in its serialized...
1
by: BLUE | last post by:
In a property i do this: .... catch(XmlException e) { throw new XmlException("Error processing configuration file!",e); } Then I catch it in another class: catch(XmlException e) {
1
by: ayemyat | last post by:
Hi All, I have a remoting service which consumes the web service in another server. I have the following exception throw by the web service. System.Xml.XmlException: The data at the root level...
3
by: =?Utf-8?B?RWQgS3JhbWVy?= | last post by:
I thought this might be useful for someone... I was doing a little work earlier using an Xmldocument class to create & maintain a minor store of data in Xml format. I'd gotten the whole thing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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.