The XML Declaration

An XML document can (and should, according to the 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, and it's an error to use upper case. (You'll still find applications out there that insist on the original uppercase version; browsers such as Internet Explorer accept either version.)

There are three possible attributes you can use in the XML ...

Get Real World 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.