# The document is not mappable to XML 1.0 due to a trailing hyphen in a comment.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-document-is-not-mappable-to-xml-1-0-due-to-a-trailing-hyphen-in-a-comment
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

XML 1.0 doesn't allow a comment to end with a hyphen, and in HTML pages this usually comes from PHP code that never ran or from a comment typed with single hyphens, such as `<!- note ->`.

When the HTML parser meets `<?`, or `<!` without `--` or `DOCTYPE` after it, or `</` followed by something other than a letter, it reads everything up to the next `>` as a "bogus comment". If the character right before that `>` is a hyphen, the comment text ends with `-`. Browsers don't mind, but an XML 1.0 comment can't end that way, so the validator flags it. Look for an error at the same spot, such as `Bogus comment.` or one about XML processing instructions. Fixing that error clears this warning too.

PHP that reaches the browser without being run is a typical source, because its `->` operator puts a `-` right before a `>`. If the server sends `<?php echo $page->title; ?>` as is, the bogus comment starts at `<?` and stops inside `->`. The rest of the code, `title; ?>`, shows up on the page as plain text. Check that the server runs the file through PHP (usually it needs a `.php` extension) and that PHP is enabled for that directory. If the code is meant to be shown on the page, as in a tutorial, escape the `<` as `&lt;`.

The other usual source is a comment typed as `<!- note ->` with single hyphens. HTML comments open with `<!--` and close with `-->`.

## Invalid example

```html
<!- Main navigation ->
<nav>
  <a href="/">Home</a>
</nav>
<h1><?php echo $page->title; ?></h1>
```

## Valid example

```html
<!-- Main navigation -->
<nav>
  <a href="/">Home</a>
</nav>
<h1>About us</h1>
```
