XML Names

If an XML parser is to properly process an XML document, it must know which characters are permitted in which locations. So, let's take a brief look at the legal characters that can be used in constructing an XML name.

All XML names must begin with a letter, an underscore character (_), or a colon (:). In practice, avoid starting an XML name with a colon because it's used, in effect, as a continuation character in namespaces, and so on. In fact, although it's legal, you should entirely avoid using a colon except as a namespace continuation character.

A name can continue using either the characters that are valid to begin a name, or using digits, hyphens, or full stops.

XML is case sensitive. Therefore, an element named <MyName> is treated ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 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.