xmlns attribute produces XHTML validation error.

C.W.Holeman II

Usenet Archive
Joined
Jan 3, 2007
Messages
25
Reaction score
0
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
 

Andy Dingley

Usenet Archive
Joined
Feb 23, 2000
Messages
3,303
Reaction score
0
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
 

Johannes Koch

Usenet Archive
Joined
Nov 14, 2000
Messages
801
Reaction score
0
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.W.Holeman II

Usenet Archive
Joined
Jan 3, 2007
Messages
25
Reaction score
0
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
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top