Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Parsing Error: not well-formed

Tags:

xml

I am creating a sitemap XML from my database it's about videos sitemap. In XML, I am fetching the video title as title and description as description, but there are some titles and descriptions written in Thai, Portuguese, German, and other languages. While generating the XML through PHP I am facing a problem that says:

"XML Parsing Error: not well-formed".

Generation of the XML stops after encountering this error.

XML Parsing Error: not well-formed
Location: http://localhost/mydesk/sitemap.php
Line Number 24489, Column 69:

I observed it contained invalid characters like listed below, and I have replaced all types of these characters, but I realized there are other characters being used in other languages.

Ð ž ´ Ø ¸ à ½ Ð ‰ ˆ Ù ° § ¼ ¡ ‹ ± …  ³ è ¾ Ñ € ¦ ƒ Ñ ‡ ª Ñ Ï ¿ ¬ µ š † Ð ½ ¹ Œ ² Ð ¼ Î ¶ € Ð µ ] : å < * © > % â © # " ' ä æ ï ã Š ç › Š º Ž ¥ œ • ¤ ç ã ® ˜ ¢ ¨ ¯ £

Is there any way to handle this issue that supports all languages?

like image 422
user838037 Avatar asked Apr 07 '12 05:04

user838037


People also ask

What is XML parsing error not well formed?

"XML Parsing Error" occurs when something is trying to read the XML, not when it is being generated. Also, "not well-formed" usually refers to errors in the structure of the document, such as a missing end-tag, not the characters it contains.

Is not well formed XML?

If an XML document is parsed by an XML parser and some irregularities are found, it generates some errors and it is then denoted as an XML file , which is not a well-formed XML document. Well-formed XML is an XML document which follows some rules specified by W3C.


1 Answers

I had the same error in Firefox, parsing an SVG string, and it only disappeared with "text/html" as mimeType. I had tried 'image/svg+xml' and 'application/xml' before and found in the https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString manual they are functionally equivalent anyway, so I tried..

like image 179
ekkev Avatar answered Oct 11 '22 04:10

ekkev