# Attribute “xmlns:serif” not allowed here.

> Canonical HTML version: https://rocketvalidator.com/html-validation/attribute-xmlns-serif-not-allowed-here
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

In HTML5, the only namespace attributes recognized on SVG elements are `xmlns` (for the SVG namespace) and `xmlns:xlink` (for XLink, though `xlink` is now largely deprecated in favor of plain attributes). Any other custom namespace declarations — such as `xmlns:serif`, `xmlns:inkscape`, or `xmlns:sketch` — are not permitted by the HTML specification and will trigger a validation error.

Design tools like Affinity Designer, Adobe Illustrator, Inkscape, and Sketch often embed proprietary namespace declarations and metadata attributes in exported SVG files. These serve as internal markers for the design application (for example, to preserve layer names or editor-specific settings) but have no meaning in a web browser. Browsers simply ignore them, so they add unnecessary bytes to your page without providing any benefit.

Removing these attributes is important for several reasons:

- **Standards compliance:** The HTML5 parser has a fixed list of allowed namespace declarations. Custom ones violate the spec.
- **Clean markup:** Proprietary metadata bloats your SVG files with information that only matters inside the originating design tool.
- **Maintainability:** Removing tool-specific artifacts makes your SVGs easier to read, edit, and optimize.

To fix this, open your SVG file (or the HTML file containing inline SVGs) and remove the `xmlns:serif` attribute from the `<svg>` element. You should also search for and remove any attributes prefixed with `serif:` (such as `serif:id`) throughout the SVG, since those depend on the now-removed namespace declaration.

For a more automated approach, consider using [SVGO](https://github.com/svg/svgo) or similar SVG optimization tools, which strip out editor metadata and unnecessary namespace declarations by default.

## Examples

### Incorrect — custom namespace attribute present

```html
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:serif="https://www.serif.com/"
  viewBox="0 0 100 100">
  <circle serif:id="MainCircle" cx="50" cy="50" r="40" fill="blue" />
</svg>
```

This triggers two types of errors: `xmlns:serif` is not allowed on the `<svg>` element, and `serif:id` is not a recognized attribute on `<circle>`.

### Correct — custom namespace and prefixed attributes removed

```html
<svg xmlns="http://www.w3.org/2000/svg"
  viewBox="0 0 100 100">
  <circle cx="50" cy="50" r="40" fill="blue" />
</svg>
```

### Incorrect — multiple proprietary namespaces

Design tools sometimes add several custom namespaces at once:

```html
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:serif="https://www.serif.com/"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  viewBox="0 0 200 200">
  <g serif:id="Layer1">
    <rect x="10" y="10" width="80" height="80" fill="red" />
  </g>
</svg>
```

### Correct — only standard namespaces retained

```html
<svg xmlns="http://www.w3.org/2000/svg"
  viewBox="0 0 200 200">
  <g>
    <rect x="10" y="10" width="80" height="80" fill="red" />
  </g>
</svg>
```

Note that `xmlns:xlink` was also removed in this example. While it won't always trigger a validation error by itself, it's unnecessary if no `xlink:href` attributes are used — and modern HTML5 SVG usage favors plain `href` over `xlink:href` anyway.
