Multiple choice general knowledge science & technology

What is the correct syntax of the declaration which defines the XML version?:

  1. <xml version="1.0" />

  2. <?xml version="1.0"?>

  3. <?xml version="1.0" />

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The claimed answer B () is correct. The XML declaration must use a question mark at both the start and end, not a slash like regular tags. Option A incorrectly uses and />, Option C incorrectly uses /> instead of ?>, and Option D is incorrect since B is valid.

AI explanation

An XML document's version declaration (the XML prolog) must be written as , using the `...?&gt;` processing-instruction syntax rather than a regular tag. Options using or a self-closing `` don't match the syntax XML parsers require for the prolog.