Skip to main content
HTML Validation

Bad value X for the attribute “xmlns” (only “http://www.w3.org/2000/svg” permitted here).

About This HTML Issue

On <svg> and the elements inside it, the xmlns attribute can only hold the SVG namespace, http://www.w3.org/2000/svg.

When the HTML parser reads inline SVG, it places <svg> and its descendants in the SVG namespace by itself, whatever xmlns says. The main exception is content inside <foreignObject>, which is parsed as HTML. Because the attribute can't change the namespace, the HTML standard makes any other value a parse error, whether it sits on the <svg> element or on a child such as <g> or <path>. A trailing slash or the XHTML namespace triggers it just like an unrelated URI does.

Design tools are a common source. Adobe Illustrator can export a <metadata> block holding an <sfw> element declared in its own Save for Web namespace, http://ns.adobe.com/SaveForWeb/1.0/. In a standalone .svg file, which is parsed as XML, that declaration puts <sfw> in Adobe's namespace. Pasted into HTML, the declaration has no effect and <sfw> becomes an unknown SVG element, so the validator also reports sfw and slices as unknown elements. Browsers don't render <metadata>, so deleting the block leaves the graphic unchanged, and SVG optimizers such as SVGO remove it by default.

For the attribute itself, either set it to exactly http://www.w3.org/2000/svg or remove it, because inline SVG in HTML doesn't need it.

Invalid example

<svg viewBox="0 0 24 24" width="24" height="24">
  <metadata>
    <sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/">
      <slices></slices>
    </sfw>
  </metadata>
  <circle cx="12" cy="12" r="10" fill="teal"/>
</svg>

Valid example

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
  <circle cx="12" cy="12" r="10" fill="teal"/>
</svg>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries