Re: Serving XHTML+RDFa as application/xhtml+xml

The problem is that the DOCTYPE you are using is not one that is known 
to the user agents and the user agents are not dereferencing the 
referenced DTD to learn about the entities.  As a result, named entities 
other than the 5 defined by XML will not work in such pages.

I was not myself aware of this issue until a few days ago.  The easiest 
solution is to use numeric entity references instead of named entity 
references.  PHP probably even has a module that will magically 
transform them for you on the way out.

Sam Kuper wrote:
> Dear all,
> 
> If this is not an appropriate mailing list for my query below, please
> could you direct me to a better list, and accept my apologies for
> posting to the wrong place?
> 
> The PHP document below produces an error in Firefox and Safari, both
> of which - if I'm not mistaken - accept application/XHTML+xml:
> 
> <?php header("Content-Type: application/xhtml+xml; charset=utf-8");
> echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
> "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://www.w3.org/1999/xhtml
> http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>     dir="ltr">
>     <head>
>         <meta http-equiv="Content-Type"
> content="application/xhtml+xml; charset=UTF-8" />
>         <title>Test</title>
>     </head>
>     <body>
>         <p>Just a test&hellip;</p>
>     </body>
> </html>
> 
> Yet, if I "view source" in those browsers after loading the resulting
> page, and paste that source code into the W3C validator, the validator
> finds it valid. What, then, am I doing wrong; or is this a bug in
> those browsers?*
> 
> Many thanks for your help,
> 
> Sam
> 
> *A few notes:
> - If I remove the string "&hellip;", then the page above renders
> without error messages, albeit without the ellipsis.
> - If I replace the string "&hellip;" with an ellipsis character
> (copied from Wikipedia, for instance, and pasted into the PHP code),
> then the page renders without error messages and with the ellipsis.
> This would be a fine solution if it weren't for the fact that other
> people who I'm working with may want to be able to enter such
> characters as HTML entity references such as "&hellip;". So I need to
> be able to achieve a result that will allow them to do so.
> - If I replace the string "application/xhtml+xml" in the first line
> with "text/html", then the page renders without error messages and
> with the ellipsis. For the time being, this is the solution I've
> adopted, but for browsers that support application/xhtml+xml, I'd
> rather serve application/xhtml+xml, as this specified as a SHOULD in
> http://www.w3.org/TR/rdfa-syntax/ (unless I've misunderstood).

-- 
Shane P. McCarron                          Phone: +1 763 786-8160 x120
Managing Director                            Fax: +1 763 786-8180
ApTest Minnesota                            Inet: shane@aptest.com

Received on Tuesday, 27 January 2009 17:28:57 UTC