# Attribute “xmlns:cc” not allowed here.

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

The `xmlns:cc` attribute declares the Creative Commons namespace used in SVG metadata, and HTML doesn't allow prefixed namespace declarations on `<svg>` or any other element.

Files saved by Inkscape often have `xmlns:cc="http://creativecommons.org/ns#"` on the root `<svg>` element. The prefix is for the Creative Commons terms in the file's RDF metadata. `<cc:Work>` wraps the description of the drawing, and if you pick a license under Document Properties, `<cc:license>` records it. In a standalone `.svg` file, which is XML, the declaration is valid. The error shows up when that markup ends up inside an HTML page, pasted by hand or inlined by a template or build step.

The HTML parser doesn't process namespace declarations, so `xmlns:cc` stays a plain attribute with a colon in its name. The validator rejects it on `<svg>`, and on `<html>` or `<div>` too. On `<svg>` it accepts just two namespace attributes, `xmlns` and `xmlns:xlink`. Inkscape exports usually put `xmlns:cc` next to `xmlns:dc`, `xmlns:rdf`, `xmlns:sodipodi` and `xmlns:inkscape`, and each of those gets its own message.

Delete `xmlns:cc` from the `<svg>` tag, and delete the `<metadata>` block with it. The `cc:` elements in that block break for the same parser reason. `<cc:Work>` becomes an SVG element whose name happens to contain a colon, and the validator reports `cc:work` and `cc:license` as completely-unknown elements in SVG content. None of the metadata is drawn, so the image doesn't change.

That block may be the only place the file states its license. If the license matters, keep the original `.svg`, metadata and all, in your source files, and show the license where readers can see it, such as in a caption under the image.

To stop the declaration from coming back, optimize the SVG before it gets inlined. SVGO's default preset runs `removeEditorsNSData`, which removes the Creative Commons namespace along with the Inkscape and Sodipodi ones, and `removeMetadata`, which removes the `<metadata>` block.

## Invalid example

```html
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:cc="http://creativecommons.org/ns#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  width="120" height="120" viewBox="0 0 24 24">
  <metadata>
    <rdf:RDF>
      <cc:Work rdf:about="">
        <cc:license rdf:resource="https://creativecommons.org/licenses/by/4.0/" />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <path d="M5 12l5 5L20 7" fill="none" stroke="currentColor" stroke-width="2" />
</svg>
```

## Valid example

```html
<figure>
  <svg width="120" height="120" viewBox="0 0 24 24" role="img">
    <title>Checkmark</title>
    <path d="M5 12l5 5L20 7" fill="none" stroke="currentColor" stroke-width="2" />
  </svg>
  <figcaption>
    Icon licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
  </figcaption>
</figure>
```
