Is an unexpected token. The expected token is

The parser found a character where XML syntax requires a specific one, most often a quote or an equals sign.

The message, as .NET reports it
'2' is an unexpected token. The expected token is '"' or '''. Line 1, position 11.

Why it happens

  • An attribute value without quotes (qty=2): the expected token is a quote.
  • An attribute without a value (<input disabled/>): the expected token is =.
  • A typographic quote (“) instead of a straight one.

How to fix it

Write every attribute as name="value" with straight quotes.

.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

xmlvalid validates with libxml2, which reports it as AttValue: " or ' expected. It checks the whole document in your browser and lists every schema error with its line and column, not only the first.

AttValue: " or ' expected

Example

Reports the error
<item qty=2/>
Fixed
<item qty="2"/>