|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.Xml.XmlExceptionI 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???
Show quote
Hide quote
> Hi, The error seems to say the XML isn't formatted correctly.> 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??? 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
Other interesting topics
HELP: Table height in the new XHTML???
How to Remote a custom membership or profile provider ??? ASP.NET 2.0: Global.asax Design Surface Gone Populating FormView (asp.net 2.0 using vb.net) Adding domain user to local groups Where to set timeout Casting Error AddDays exception when subtracting value GridView with dropdown: asp.net 2.0 Error accessing network resources in ASP.Net |
|||||||||||||||||||||||