News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

Element Naming

Started by ben2ong2, October 05, 2006, 05:04:54 PM

Previous topic - Next topic

0 Members and 8 Guests are viewing this topic.

ben2ong2

XML elements must follow these naming rules:
·   Names can contain 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).

You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login