September 18, 2002
Garbage Out
A gripe: XML namespaces. The W3 validator doesn’t like ‘em. Which is bad, because namespaces are vital to embedding XML (like RDF, MathML and SVG) into XHTML. Consider the following snippet:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:sa="http://www.scottandrew.com">
<head>
<title>XML in XHTML</title>
</head>
<body>
<sa:p>
This is a P element from the "sa" namespace.
</sa:p>
</body>
</html>
The validator returns the following error:
Error: there is no attribute "xmlns
This is all very frustrating to those of us who have come to use and trust the validator yet want to use the XML features of XHTML. I shouldn’t have to resort to some conditional hack to show my pages validate. It would be nice if the validator politely reported that elements from exotic, alien namespaces had been detected and only checked for well-formedness. Anything is better than belching out an error for otherwise valid markup.










