- it consist letters, numbers, and other characters
- Names must not start with a number or punctuation
character
- Names must not start with the letters xml (or XML, or
Xml, etc)
- Names cannot contain spaces
Take care when you "invent" element names and follow these
simple rules:
Any name can be used, no words are reserved, but the idea is
to make names descriptive. Names with an underscore separator
are nice.
Examples: <first_name>, <last_name>.
Avoid "-" and "." in names. For example, if you name
something "first-name," it could be a mess if your software
tries to subtract name from first. Or if you name something "first.name,"
your software may think that "name" is a property of the object
"first."
Element names can be as long as you like, but don't
exaggerate. Names should be short and simple, like this: <book_title>
not like this: <the_title_of_the_book>.
XML documents often have a corresponding database, in which
fields exist corresponding to elements in the XML document. A
good practice is to use the naming rules of your database for
the elements in the XML documents.
Non-English letters like ��� are perfectly legal in XML
element names, but watch out for problems if your software
vendor doesn't support them.
The ":" should not be used in element names because it is
reserved to be used for something called namespaces (more later).
|