Top 3 Products & Services
Dated: Mar. 26, 2012
Related CategoriesXML (Extensible)
Here is a short and to the point method of learning the naming convention of XML Elements.
XML elements must follow these naming rules:
- Names can contain letters, numbers, and other characters
- Names must not start with a number or other punctuation characters
- Names must not start with the letters xml (or XML or Xml ..)
- 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. It could be a mess if your software tried to subtract name from first (first-name) or think that "name" is a property of the object "first" (first.name).
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).
Now that you've gotten free know-how on this topic, try to grow your skills even faster with online video training. Then finally, put these skills to the test and make a name for yourself by offering these skills to others by becoming a freelancer. There are literally 2000+ new projects that are posted every single freakin' day, no lie!