What rules do you need to keep in mind while defining XML elements.

Q5. What rules do you need to keep in mind while defining XML elements?

Ans. The following are some rules that need to be considered while defining XML elements:

  1. Elements names can start with letters or the underscore (_) character, but not numbers or punctuation characters.
  2. After the first character, you can use numbers and characters, such as hyphen (-) and period (.), in the characters.
  3. Element names cannot contain spaces.
  4. Element names cannot contain the: character because it is reserved character or keyword (that is, it has specific meaning in XML) in the XML specification. Therefore, you should avoid using it in your documents.
  5. Element names cannot start with the word xml in any form (XML or Xml or xml).
  6. Element names cannot have a blank space after the opening character (<); the name of the element must come immediately after it. However, there can be space before the closing character (>).

Leave a Reply

Your email address will not be published. Required fields are marked *

4 Views
%d bloggers like this: