# Attribute “xmlns:w” not allowed here.

> Canonical HTML version: https://rocketvalidator.com/html-validation/attribute-xmlns-w-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-related attribute permitted on the `<html>` element is `xmlns` with the value `http://www.w3.org/1999/xhtml`, and even that is optional—it exists solely for compatibility with XHTML serialization. Prefixed namespace declarations like `xmlns:w`, `xmlns:o`, `xmlns:v`, and similar attributes are XML features that have no meaning in the HTML syntax. They originate from Microsoft Office's HTML export, which generates markup containing proprietary XML namespaces such as `urn:schemas-microsoft-com:office:word` for Word-specific elements and styling.

## Why This Is a Problem

**Standards compliance:** The HTML living standard (WHATWG) explicitly does not support custom namespace declarations. Including them makes your document non-conforming, and the W3C validator will report an error for each one.

**No browser benefit:** Modern browsers parsing HTML5 ignore these namespace declarations entirely. The attributes serve no functional purpose on the web—they only add unnecessary bloat to your markup.

**Maintenance and readability:** Office-generated HTML is notoriously verbose. Leaving namespace declarations in place often goes hand-in-hand with other Office artifacts (conditional comments, `<o:p>` tags, `mso-` style properties) that clutter your code and make it harder to maintain.

**Accessibility and interoperability:** While browsers typically tolerate these extra attributes without visible issues, non-browser HTML consumers—such as screen readers, search engine crawlers, or email clients—may handle unexpected attributes unpredictably.

## How to Fix It

1. **Remove the `xmlns:w` attribute** from your `<html>` tag or any other element where it appears.
2. **Remove related namespace declarations** like `xmlns:o` (Office), `xmlns:v` (VML), and `xmlns:m` (Math) if present.
3. **Clean up Office-specific elements** such as `<w:Sdt>`, `<o:p>`, or `<v:shape>` that depend on those namespaces—these are not valid HTML elements.
4. **Strip Office-specific CSS** properties prefixed with `mso-` (e.g., `mso-bidi-font-family`) that often accompany namespace declarations.

If you regularly paste content from Microsoft Word, consider using a "paste as plain text" feature in your editor, or use an HTML cleaning tool to strip Office artifacts automatically.

## Examples

### Invalid: Office namespace on the `<html>` element

```html
<!DOCTYPE html>
<html lang="en" xmlns:w="urn:schemas-microsoft-com:office:word">
  <head>
    <title>Document</title>
  </head>
  <body>
    <p>Content from Word</p>
  </body>
</html>
```

### Invalid: Multiple Office namespaces

```html
<!DOCTYPE html>
<html lang="en"
  xmlns:w="urn:schemas-microsoft-com:office:word"
  xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <title>Document</title>
  </head>
  <body>
    <p class="MsoNormal">Content from Word<o:p></o:p></p>
  </body>
</html>
```

### Valid: Clean HTML without namespace declarations

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Document</title>
  </head>
  <body>
    <p>Content from Word</p>
  </body>
</html>
```

### Valid: Using the standard `xmlns` attribute (optional)

If you need XHTML compatibility, the standard `xmlns` attribute (without a prefix) is permitted:

```html
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Document</title>
  </head>
  <body>
    <p>Content from Word</p>
  </body>
</html>
```

Note that this same validation error applies to any custom prefixed namespace attribute—not just `xmlns:w`. If you see similar errors for `xmlns:o`, `xmlns:v`, `xmlns:st1`, or others, the fix is the same: remove them along with any elements or attributes that depend on those namespaces.
