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

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-the-attribute-xmlns-only-http-www-w3-org-2000-svg-permitted-here
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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

```html
<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

```html
<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>
```
