XML Element Names

I've already discussed some aspects of naming your XML element tags, such as their case-sensitivity and the convention to use all lowercase characters. There are a few more rules and conventions regarding element names. Rules that you must follow include:

• Names may contain letters, numbers, and other characters.

• Names must not start with a number or punctuation character.

• Names must not start with XML (or any other form of these letters in a different case).

• Names must not contain spaces.

Remember to use descriptive names for your tags, but avoid the following:

• Overly long names. Names should be descriptive and as short as possible. For example, don't use the_students_first_name when first_name is sufficient.

• Using the dash (-), colon (:) or period (.) in a name. Depending on the software that reads your XML document, you could get into some trouble using these characters as the program may try to subtract something, or try to invoke a property or method of an unknown object. The colon is reserved for something called namespaces (not discussed) and should never be used in an element's name.

• Unusual characters that may not be supported on all platforms. Characters with umlauts, accents, and so forth are legal in XML, but if they are not supported by the software using your XML document, the program may crash.

Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook


Post a comment