# Name cannot begin with the character

Source: https://xmlvalid.com/errors/name-cannot-begin-with-the-character

> A &lt; in text that does not start a valid tag.

The message, as .NET reports it: `Name cannot begin with the ' ' character, hexadecimal value 0x20. Line 1, position 10.`

## Why it happens

- A literal `<` in text, such as a comparison: what follows it is read as a tag name.
- A tag name starting with a digit, a space or another character names may not start with.

## How to fix it

- Write `&lt;` for a literal `<` in text, or use a CDATA section.
- .NET throws an `XmlSchemaValidationException` at the first schema error unless `XmlReaderSettings.ValidationEventHandler` is set, which then receives every one with its line and position. A well-formedness error is an `XmlException` and ends reading whatever the settings.

## The same problem in xmlvalid

libxml2, which xmlvalid validates with, reports it as [StartTag: invalid element name](https://xmlvalid.com/errors/starttag-invalid-element-name): `StartTag: invalid element name`

## Example that fails

```xml
<expr>a < b</expr>
```

## Fixed

```xml
<expr>a &lt; b</expr>
```
