![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
working with xml and c# and get this error
Hello,
I am working with xml and c# and I ge this error: The data at the root level is invalid, when I try to read the xml document. Here is the code that I am working with: public static Response Message(string doc)
{
StringReader reader = new StringReader(doc);
XmlTextReader textReader = new XmlTextReader(reader);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(textReader); //gets stuck here
return Response.Message(xmlDoc);
}Any ideas on what this problem could be would be great. Thanks in advance |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Sep 2004
Posts: 207
Rep Power: 5
![]() |
I've never used this but ...
xmlDoc.Load is probably supposed to point to the path of an XML file. Right now your just loading a XmlTextReader into an XmlDoc which if you think about it doesn't make much sense. :p
__________________
_______________________________ BlazingWolf |
|
|
|
|
|
#3 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
An XmlTextReader is valid input for XmlDocument.Load. Could you post the Xml file?
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Sep 2004
Posts: 207
Rep Power: 5
![]() |
My bad lol Like I said I've never used that.
__________________
_______________________________ BlazingWolf |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
the xml file looks like this
<?xml version="1.0" encoding="utf-8" ?> <LoggedIn></LoggedIn> and doc is string of the location of the xml file. Last edited by dark_omen; May 6th, 2005 at 7:46 AM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|