xmlns attribute produces XHTML validation error.

C

C.W.Holeman II

I have an xmlns attribute that produces an XHTML validation error and I
do not understand why it is considered an error.The file displays as
expected on Firefox and IE7.

http://emle.sourceforge.net/emle020100/lab/ng20070625_emle_lab_001-e.xml.html


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html dir="ltr" xml:lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>NG 2007-06-25</title>
</head>
<body>
<h1>NG 2007-06-25</h1>
<xhtml:p xmlns="http://emle.sourceforge.net/emle020100"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
Test
</xhtml:p>
</body>
</html>

When I run it through the W3C validator it identifies several errors.

http://validator.w3.org/check?uri=h...ctype=Inline&ss=1&outline=1&No200=1&verbose=1
> Error Line 13, column 15: there is no attribute "xmlns" .
>
> <xhtml:p xmlns="http://emle.sourceforge.net/emle020100"

_HTML & XHTML The Definitive Guide_ (6th Edition) by Musciano & Kennedy
section 16.2.2, page 497:
> ...the xmlns attribute... You can place it within the start tag of any
> element within your document...

The example with the error is a reduced version of the results produced
by:
http://emle.sourceforge.net/emle020100/lab/ng20070625_emle_lab_001.xml
For more context of what I am working upon see:
http://emle.sourceforge.net/emle020100/ng20070620_context.html
 
A

Andy Dingley

I have an xmlns attribute that produces an XHTML validation error and I
do not understand why it is considered an error.

Take it to c.i.w.a.h if you want to _understand_ why (and put your
flame-proof pants on first)

The root of it is this:
Content-Type: text/html

You're not using XHTML, you're using XHTML Appendix C. It's XML
content, but sent out deliberately mis-labelled as HTML so that it
gets processed as HTML (ie SGML) and thus makes IE work. It's a hack,
but it's still the only way to serve XHTML to the majority of
browsers.

Under Appendix C, you can't do namespacing (meaningless in SGML), so
of course your code is invalid.

It's also arguable that you can't do Appendix C for XHTML 1.1 and can
only do it for XHTML 1.0
 
J

Johannes Koch

C.W.Holeman II said:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html dir="ltr" xml:lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>NG 2007-06-25</title>
</head>
<body>
<h1>NG 2007-06-25</h1>
<xhtml:p xmlns="http://emle.sourceforge.net/emle020100"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
Test
</xhtml:p>
</body>
</html>

When I run it through the W3C validator it identifies several errors.

http://validator.w3.org/check?uri=h...ctype=Inline&ss=1&outline=1&No200=1&verbose=1

DTDs are not namespace-aware, and so validation against a DTD isn't
either. The only element for which the DTD allows an xmlns-Attribut is
the unprefixed html element.

If you want namespace-aware validation use XML schema.
 
C

C.W.Holeman II

Johannes said:
DTDs are not namespace-aware, and so validation against a DTD isn't
either. The only element for which the DTD allows an xmlns-Attribut is
the unprefixed html element.

If you want namespace-aware validation use XML schema.

And if I want to use "XHTML 1.1 plus MathML 2.0 plus SVG 1.1" I live
with those errors and understand that if an XML Schema pops up for that
combination I can get a validation to report the file as OK.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top