XML Tutorial Step 3

XML Syntax Rules
The syntax rules of XML are very simple and logical. One can easily learn and use them.

  • All XML Elements Must Have a Closing Tag
  • All Tags are case sensitive.
  • XML Elements must be properly nested.
  • The XML document must have a root element.
  • All the attribute values must be quoted.
  • Comments are also permitted in XML using tag
  • The white spaces in XML are not truncated
  • The new line charecter is represented with Line Feed, the way it is in Unix environment.

XML Naming Rules

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 white spaces.
  • Any name can be used, no reserved words are there.

XML Attributes
XML elements can have attributes in the tag, just like HTML. These attributes provide additional information about elements.
These attributes are used to provide additional information that is not part of the data.

XML attributes must be quoted, either single or double quotes can be used. If the attributes itself contains double quotes one can use single quotes.
Some of the problems in using attributes are:

  • attributes cannot contain multiple values but elements can.
  • attributes cannot contain tree structures but elements can.
  • attributes are not easily expandable required for future changes.


Go to Step1 or Step2 or Step4

AddThis Feed Button
Please provide your feedback by sending an email to 1234java.blogspot@gmail.com. This would help me making the site more helpful. Thanks in advance.

DISCLAIMER:

The content provided in this article/site is not warranted or guaranteed by 1234java.blogspot.com. The content provided is intended for educational purposes in order to introduce to the reader key ideas, concepts. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials.