XML namespace error message

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
TomHTML
Rank II - Novice
Rank II - Novice
Posts: 28
Joined: Sun Feb 04, 2018 10:19 am

XML namespace error message

Post by TomHTML » Sun Nov 11, 2018 6:39 pm

The Validator indicates

Code: Select all

xmlns:svgjs="http://svgjs.com/svgjs"
in the HTML below is an error, explaining:
Attributes of the form xmlns:prefix (like this "xmlns:svgjs" attribute) must not be used in HTML (but can be used in XHTML)

Code: Select all

<svg id="SvgjsSvg1006" width="300" height="300" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs">
        <defs id="SvgjsDefs1007"></defs>
        <rect id="SvgjsRect1008" width="100" height="100" fill="#ff0066"></rect>
</svg>
And the W3 validator also indicates that this is an error but I can't find the proper spec for it, save perhaps the concluding part of section 8.1.2.3 here: https://www.w3.org/TR/html5/syntax.html#attributes-0

Could the exact spec that elucidates this be provided in the Validator's error message? I'm corresponding with the authors of a JavaScript library that generates SVG elements with the errant namespace attribute, and I'd like to be able to cite a spec that makes the case clear.

Many thanks!

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3363
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: XML namespace error message

Post by Albert Wiersch » Mon Nov 12, 2018 10:08 am

Hello Tom,

I found this link:
https://wiki.whatwg.org/wiki/Why_no_namespaces

And as you found and pointed out, the HTML spec says that there is only a specific list of namespaced attributes allowed in HTML, even in foreign content like SVG:
https://html.spec.whatwg.org/multipage/ ... tributes-2

I will add that link to the CSS HTML Validator message.

I hope this helps. Please let me know if you have any more questions.

UPDATE: The message should now read (when extended messagesare enabled (the default)):
Attributes of the form xmlns:prefix (like this "xmlns:svgjs" attribute) must not be used in HTML (but can be used in XHTML). Visit https://html.spec.whatwg.org/multipage/ ... tributes-2 for more information.

When extended messages are not enabled the message is shortened to:
Attributes of the form xmlns:prefix (like this "xmlns:svgjs" attribute) must not be used in HTML (but can be used in XHTML).
Image
Albert Wiersch

Post Reply