i have developed a project in using c#, reads xml file and redirects the specified output in CSV file.
i am getting error in my code as from XDoc.LoadXml(filenamestr)
it goes directly to catch block skipping the in between commands.
try
{
XmlDocument XDoc = new XmlDocument();
XDoc.LoadXml(filenamestr);
XmlDocumentType XDType = XDoc.DocumentType;
XDoc.RemoveChild(XDType);
XDoc.Save(filenamestr + ".xml");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
and error is
{"Data at the root level is invalid. Line 1, position 1."}
and the xml lines contains:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="MeasDataCollection.xsl"?>
<!DOCTYPE mdc SYSTEM "MeasDataCollection.dtd">
<mdc xmlns:HTML="http://www.w3.org/TR/REC-xml">
<mfh>
please help