After reading about character encodings, an astute reader may wonder how to declare the encoding in the document so an XML processor knows which one you're using. The answer is: declare the decoding in the XML declaration. The XML declaration is a line at the very top of a document that describes the kind of markup you're using, including XML version, character encoding, and whether the document requires an external subset of the DTD. The declaration looks like this:
<?xml version="1.0" encoding="utf8" standalone="yes"?>
The declaration is optional, as are each of its parameters (except for the required version attribute). The encoding parameter is important only if you use a character encoding other than UTF-8 (since it's the default encoding). If explicitly set to "yes", the standalone declaration causes a validating parser to raise an error if the document references external entities.
Copyright © 2002 O'Reilly & Associates. All rights reserved.