21288 Posts in 5733 Topics by 2602 members
| Go to End | Next > | |
| Author | Topic: | 2003 Views |
-
XML Parsing Error

28 April 2010 at 4:12pm
Hi,
I use firefox, then is error,XML Parsing Error: not well-formed
Location: http://localhost/nhp_vn/tin-nhp/
Line Number 71, Column 70:
<td style="font-weight:bold;"><a href="tin-nhp/?newsID=9&offset=1">Test News</a></td>
-------------------------------------------------------------------------------------^But when using IE will not error happen.
Help me! -
Re: XML Parsing Error

28 April 2010 at 4:59pm
Just a guess, could it be that the & in the href should be &?
i.e:
<a href="tin-nhp/?newsID=9&offset=1">
-
Re: XML Parsing Error

28 April 2010 at 7:19pm Last edited: 28 April 2010 7:20pm
Remove the XML header <?xml version="1.0" encoding="UTF-8"?> from your template.
It can break a lot of stuff, namely:
- You will get an XML error every time you enter an & or sometimes " in the CMS (for example as Page-Title)... unless you escape values properly in the template. It should be $Title.XML for regular usage and $Title.ATT for attributes.
- JavaScript that rely on document.write won't work. Example: Google Analytics default integration.
- JavaScript must be wrapped in a <![CDATA[ ]]> block.So most of the time it's a better idea to get rid of the XML header.
-
Re: XML Parsing Error

28 April 2010 at 8:33pm
Won't it break html validation if you leave out the XML header?
I don't think it's a good idea to remove it. To me it's like having a warning system, and rather than addressing the issues that are causing the warnings, you are turning off the warning system.
-
Re: XML Parsing Error

28 April 2010 at 9:46pm Last edited: 28 April 2010 9:54pm
No, it won't break HTML Validation. Your pages will still be valid XHTML, but just aren't parsed by the browser to be strictly XML compliant (which is another thing than XHTML). Also, XML documents have some restrictions in combination with JavaScript. This includes document.write and some jQuery functionality and plugins.
I used to think the same way as you do, but the XML header causes so many problems, it's just not worth it to go and fix stuff for this (I'm talking about code written by third parties like jQuery plugins, that work perfectly fine without the XML header).Update: You don't need the "warning" system you speak of, validation covers that already (eg. an unescaped ampersand also fails validation).
Update 2: FYI: Here's an example of a native jQuery function that doesn't work with an XML document: http://api.jquery.com/html
Plugins relying on this function will fail.. not sure if there are other functions like this, but it's possible...
| 2003 Views | ||
| Go to Top | Next > |


, done.
