No Beginning Tag:Content Is Not Allowed In Prolog
![]() |
Content Is Not Allowed In Prolog |
Prolog error is also shown when yhe XML header do not have a beginning tag “<” before thePseudo Attribute, firstquestion mark in the XML header as shown in the image. If the document in not proper UTF and there are invisible characters between the XML header, a prolog error can be shown.
AOnline Syntax Error Parsing XML Validator Toolcan be used to check the parsing errors and find invisible characters.
To Solve this Prolog error;
Copy either of the below code and replace it with the existing XML header;
<?xml version=”1.0″ encoding=”UTF-16″ standalone=”no”?>
or
<?xml version=”1.0″ encoding=”UTF-8″ ?>
Byte Order Markers
Byte order markers could be in the buffer. Before passing the buffer to the Parser do this.
String xml = “<?xml …”;
xml = xml.trim().replaceFirst(“^([\W]+)<“,”<“);
Clearing the white spaces between characters also helps in sorting out the issue. If the XML header has white space before it, you may encounter another error:The processing instruction target matching “[xX][mM][lL]” is not allowed as shown in the below image.
![]() |
The processing instruction target matching “[xX][mM][lL]” is not allowed |
Characters Before XML header:Content Is Not Allowed In Prolog
![]() |
Characters Before XML header |