Unable to parse any XML input. Error on line 1: The markup in the document preceding the root element must be well-forme

Having trouble installing Oxygen? Got a bug to report? Post it all here.
cameron arnott
Posts: 1
Joined: Fri Oct 04, 2019 4:44 am

Unable to parse any XML input. Error on line 1: The markup in the document preceding the root element must be well-forme

Post by cameron arnott »

I am creating an XML in .net using XmlTextWriter to attach as a file in Dynamics.

When I try to test the file I get the error - Unable to parse any XML input. Error on line 1: The markup in the document preceding the root element must be well-formed.

If I open the file in notepad++ and copy and paste the contents into a new text file and save as a new XML file, the new XML file does not return the error.


Thanks.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Unable to parse any XML input. Error on line 1: The markup in the document preceding the root element must be well-f

Post by Radu »

Hi,

This forum is mostly for Oxygen XML Editor related problems and not for generic XML questions.
If I were to guess, possibly the original XML document has some kind of byte-order-mark (BOM) bytes in front of the file content. This does not necessarily mean the XML is not wellformed, just that maybe the XmlTextWriter is not 100% compliant with the XML standard.
If you download Oxygen XML Editor and try to open the XML document, does it report any error after the XML is opened? If not, in the Oxygen Preferences->"Encoding" page you can switch the "UTF-8 BOM handling" to "Don't Write", make a small change in the XML and save. Oxygen should remove the BOM bytes from before the XML content.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply