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?
Sachin SinghPosted Dec 10, 2020, 11:36 PM
John RikerPosted Dec 11, 2020, 5:00 PM