Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 5th, 2005, 2:29 PM   #1
dark_omen
Hobbyist Programmer
 
Join Date: Dec 2004
Posts: 125
Rep Power: 4 dark_omen is on a distinguished road
Send a message via AIM to dark_omen
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
dark_omen is offline   Reply With Quote
Old May 5th, 2005, 5:59 PM   #2
BlazingWolf
Hobbyist Programmer
 
Join Date: Sep 2004
Posts: 207
Rep Power: 4 BlazingWolf is on a distinguished road
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
BlazingWolf is offline   Reply With Quote
Old May 5th, 2005, 7:01 PM   #3
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
An XmlTextReader is valid input for XmlDocument.Load. Could you post the Xml file?
Dameon is offline   Reply With Quote
Old May 5th, 2005, 9:51 PM   #4
BlazingWolf
Hobbyist Programmer
 
Join Date: Sep 2004
Posts: 207
Rep Power: 4 BlazingWolf is on a distinguished road
My bad lol Like I said I've never used that.
__________________
_______________________________
BlazingWolf
BlazingWolf is offline   Reply With Quote
Old May 6th, 2005, 6:55 AM   #5
dark_omen
Hobbyist Programmer
 
Join Date: Dec 2004
Posts: 125
Rep Power: 4 dark_omen is on a distinguished road
Send a message via AIM to dark_omen
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.
dark_omen is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC