•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 374,011 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,725 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Views: 15911 | Replies: 2
![]() |
•
•
Join Date: Apr 2004
Posts: 555
Reputation:
Rep Power: 6
Solved Threads: 6
Hello,
I am trying to read this xml file. But whenever I get to the load part of it, it gives me this error: "The data at the root level is invalid. Line 1, position 1"
This is the code I am working with:
doc is the filepath of the xml document.
If anybody has any idea on how to solve this problem that would be great.
I am trying to read this xml file. But whenever I get to the load part of it, it gives me this error: "The data at the root level is invalid. Line 1, position 1"
This is the code I am working with:
publicstatic 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); }
doc is the filepath of the xml document.
If anybody has any idea on how to solve this problem that would be great.
•
•
Join Date: Jul 2003
Location: Bamberg, Germany
Posts: 117
Reputation:
Rep Power: 6
Solved Threads: 2
try:
If that doesn't work, post the xml document you're trying to read.
publicstatic Response Message(string doc)
{
XmlTextReader textReader = new XmlTextReader(doc);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(textReader);
return Response.Message(xmlDoc);
}![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
- Multiple Table Reading From An Xml File (VB.NET)
- unable to read wesite uploaded XML file (C#)
- How to re-organized XML file and call XML file from my software (RSS, Web Services and SOAP)
- Error reading XML file in Javascript (JavaScript / DHTML / AJAX)
- Reading stream with two xml files in (Java)
- Pass XML file contents to a hash table. (Java)
- problem reading text file to struct (C++)
Other Threads in the C# Forum
- Previous Thread: System.Reflection
- Next Thread: adding innertext to an xml node


Linear Mode