Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this FAQ

The XML FAQ — Frequently-Asked Questions about the Extensible Markup Language

Section 3: Authors

Q 3.3: Which parts of an XML document are case-sensitive?

All of it, both markup and text.

All of an XML document is case-sensitive. This is significantly different from HTML and most other SGML applications, where the default was to ignore case. It was done to allow markup in non-Latin-alphabet languages, and to obviate problems with case-folding in writing systems which are inherently caseless.

  • Element type names are case-sensitive: you must follow whatever combination of upper- or lower-case you use to define them (either by first usage or in a DTD or Schema). So you can't say <BODY></body>: upper- and lower-case must match; thus <Img/>, <IMG/>, and <img/> are three different element types;

  • For well-formed XML documents with no DTD, the first occurrence of an element type name defines the casing;

  • Attribute names are also case-sensitive, for example the two width attributes in <PIC width="7in"/> and <PIC WIDTH="6in"/> (if they occurred in the same file) are separate attributes, because of the different case of width and WIDTH;

  • Attribute values are also case-sensitive. CDATA values (eg xlink:href="MyFile.SGML") always have been, but NAME types (ID and IDREF attributes, and token list attributes) are now case-sensitive as well;

  • All general and parameter entity names (eg &Aacute;), and your data content (text), are case-sensitive as always.