TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
John Riker
NA
85
16.4k
Load XML without dealing with XSD?
Dec 10 2020 3:34 PM
I have an XML file that comes back with some online sources as well formed. Only complaint is it doesn't have the referenced xsd file. All the data I need is in this XML file already just need to get it loaded into my app.
When I call the URL with:
XmlDocument doc =
new
XmlDocument();
doc.LoadXml(url);
String jsonText = JsonConvert.SerializeXmlNode(doc);
return
jsonText;
I get back
Unhandled Exception: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
This happens at the: doc.LoadXml(url);
Any thoughts?
Reply
Answers (
2
)
Capture electronic signatures...
i am using vs 2010 i want to use webapi