<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
<head>
<title>23.opml</title>
<dateCreated>Tue, 23 Oct 2007 10:09:38 GMT</dateCreated>
<dateModified>Tue, 23 Oct 2007 10:09:38 GMT</dateModified>
<ownerName>Tom Morris</ownerName>
</head>
<body>
<outline text="Solving MIME type headaches" created="Tue, 23 Oct 2007 10:09:38 GMT"><outline text="My site occasionally serves invalid XML. This is an unfortunate business. The reasons are quite convoluted, but are to do with the way that you can't use CDATA sections inside attributes (&lt;a href=&quot;http://kosso.wordpress.com/&quot; rel=&quot;friend met&quot;&gt;Kosso&lt;/a&gt; will understand what I'm talking about).&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="So sometimes unencoded stuff is sent to the browser, or, as this morning, an unclosed span element.&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="I decided to fix it by writing some code that would detect whether what's about to be sent is valid XML. Simple enough. Just load it all into a DOM tree, and if it chokes on loading, it's not valid XML - then serve it as text/html to invoke the usually slower XHTML parsers.&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="&#13;" created="Tue, 23 Oct 2007 10:09:38 GMT"/><outline text="&lt;a href=&quot;http://pastebin.com/f59e7ae94&quot;&gt;Here's the code&lt;/a&gt;. It's done with &lt;a href=&quot;http://php.net/outcontrol&quot;&gt;PHP output control&lt;/a&gt; and the DOM - so PHP5 only, folks. You &lt;em&gt;do&lt;/em&gt; use PHP5, right?" created="Tue, 23 Oct 2007 10:09:38 GMT"/></outline></body>
</opml>
