Skip to main content

Search 400 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML error · prolog

standalone accepts only 'yes' or 'no'

The XML declaration's standalone pseudo-attribute has a closed vocabulary: lowercase yes or no, with no boolean aliases.

standalone accepts only 'yes' or 'no' (line 1)

What it means

standalone declares whether information outside the document entity affects the document. XML spells its only two values yes and no, case-sensitively; true, false, 1, 0 and maybe are not aliases.

This is declaration syntax, so the parser stops before it attempts to build the root element. The rest of the document may be perfectly formed and still cannot be read.

What usually causes it

  • A serializer mapped a programming-language boolean to true or false.
  • A hand-written declaration used Yes or NO rather than lowercase XML tokens.
  • A template exposed a three-state application setting directly in the declaration.
  • Copying an XML-like declaration from a format with different boolean spelling.

How to fix it

  • Use standalone="yes" only when the standalone declaration is true.
  • Use standalone="no" when external declarations may affect the document.
  • Omit standalone entirely when the producer does not know or need to assert it.

The same error elsewhere

Different parsers, same defect. If you arrived with one of these messages, you are in the right place.

  • expat (Python)

    XML declaration not well-formed: line 1, column 30
  • .NET System.Xml

    Syntax for an XML declaration is invalid.

Before and after

Both snippets are re-checked by the test suite against the real parser: the first is confirmed to produce the exact error above, the second to parse cleanly.

Fails
<?xml version="1.0" standalone="maybe"?><root/>
Parses
<?xml version="1.0" standalone="yes"?><root/>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.