XML Naming Rules

There are certain rules that must be followed when naming XML elements, attributes, entities etc..

  • XML names can contain any alphanumeric character (a-z, A-Z, and 0-9)
  • XML names can contain accented characters and characters from non-Latin script languages
  • XML names can contain punctuation characters - (hyphen), _(underscore) and . (period)
  • XML names cannot start with the word xml (in upper case or lower case or any combination)
  • XML names cannot start with numbers, -(hyphen) or . (period)
  • XML names cannot contain white spaces

XML is case-sensitive so the elements <Catalog>, <CATALOG> and <catalog> are all treated as different

The following are some valid XML names :

The following names are invalid:
<xml-Catalog> cannot start with the word xml
<movie=catalog> cannot contain =
<movie catalog> white space is not allowed
<100movie> cannot start with numbers

Post a comment


Your Comment

Email (We dont publish it)


Nothing yet..be the first to share wisdom.