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?
"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.
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.
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..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With