<root> <First child> <First sub child>.…</First sub child> <Second sub child>.…</Second sub child> </First child> </root> |
Rule 2: XML Pro log: XML prolog is optional. If XML exists then XML must come first in the document. Example:
<?xml version=”1.0″ encoding=”UTF-8“?> |
Rule 3: Case Sensitivity: XML tags are case sensitive. Example:
<author> sameed </author> <AUTHOR> sameed <AUTHOR> |
Rule 4: Attributes values must be qouted. Example:
Wrong Practice | Right Practice |
<book date=12/11/2007> <title>Book On XML</title> </book> | <book date=“12/11/2007“> <title>Book On XML</title> </book> |
Rule 5: Comment: Comment are used to give some opinion for better understanding. Example:
< ! −− this is comment − − > |
Rule 6: Starting and closing of tags:
- Every tag should have starting and ending.
- For example <author> is the starting of author tag and </author> is the closing of the author tag.
- Early starting tag should be late closed and late started tag should be early close. Example is shown in the diagram below.
