April 26, 2017

(Solved) Error parsing XML: The XML declaration must end with "?>" Blogger

Error The XML declaration must end with "?>" occurs rarely and appear in blogger templates. It happens when the doc type of XML has declared but the declaration is not closed properly. There are similar questions asked in Stack Exchange but the answer provided did not solve the parsing error of XML declaration.

XML Declaration

XML declaration have to components; version and encoding. After declaring version and encoding, the declaration has to be closed. See the following code where declaration has not closed properly.

<?xml version="1.0" encoding="UTF-8" ?
XML parsing declaration error page view
XML parsing declaration error in blogger template

Error parsing XML Declaration

Error in parsing comes when the declaration is not closed with a ">" end code or "?>". The XML declaration is the first line in blogger template hence the error appears like "Error parsing XML, line 1, column 39: The XML declaration must end with "?>"". 

How to Solve XML declaration Parsing Error

Go to blogger.com
Go to Theme
Check the first line for the XML declaration as above.
Check if the code is closed with ">" .

If you are unable to find the XML declaration in the blogger template or having trouble with it, do the following.

Press CTRL+F
Type "xml version" without quotes
You will find the Decalaration code easily.
Copy the below code and replace the line

<?xml version="1.0" encoding="UTF-8" > 
Save the blogger template and voila.

Parsing XML Error in Spring Framework

Usually XML files need a stricter version of the DTD syntax. So if you are having trouble you can use XHTML 1.0 Transitional DTD syntax. If you are getting parsing error in Spring framework, use the following code to replace the existing code;

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

Check for Other XML Validation Errors

If you want to check for other XML validation errors, go to Online XML Syntax Error Parsing Validator Tool

Don't Forget to subscribe to shipmethis

Whats Hot

About Author