The XML Declaration

An XML document can (and should, according to W3C) start with an XML declaration, which can indicate that the document is written in XML. If you use an XML declaration, it should be the first line in the document. Nothing should come before the XML declaration. Here's an example:

<?xml version = "1.0" standalone="yes" encoding="UTF-8"?>

The XML declaration uses the <?xml?> element. In earlier drafts of XML, that was <?XML?>, but it was made lowercase in the final recommendation; it's an error to use uppercase. (You'll still find applications out there that insist on the original uppercase version, however. Browsers such as Internet Explorer accept either version and are thus not fully compliant with the W3C recommendation.) ...

Get Inside XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.