O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required