XML technologies / XML / Perl & XML / Introduction to XML / The XML declaration
(Excerpt from "Perl & XML" by Erik T. Ray & Jason McIntosh)
After reading about character sets and their encoding, an attentive reader may wonder how to tell the XML processor which character set and encoding are intended. The answer is that the encoding and character set are specified in the XML declaration. The XML declaration is the first line of a document. It describes the markup it contains, including the XML version, character set and possible use of an external subset of the DTD. The declaration looks like this:
<?xml version="1.0" encoding="utf8" standalone="yes"?> The declaration is optional. With the exception of version, so are its attributes. The encoding parameter matters only when using a character set other than UTF-8 (the default character set) (Note: in Germany, this will almost always be ISO 8859-1, the official name of ISO Latin-1). If the declaration of version to "yes", a validating parser will report an error if the document uses external Entities.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "Perl & XML" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top