XML Syntax

Here is quick list of syntax rules that must be followed while creating an XML Document.

XML Documents Must Have a Root Element

An XML Document consists of a container element know as root element and other elements placed inside the root element.

In the below example <inbox>…</inbox> is acting as root element.

XML Elements Must Have a Closing Tag

All XML element must be ended using a closing tag. It is illegal to remove closing tag.

XML Tags are Case Sensitive

XML tags are case sensitive. The tag <Message> is different from the tag <message>.

Start and End tags must be written in the same case.

XML Elements Must be Properly Nested

All XML elements must be properly nested within each other. As child element should be closed before parent element.

XML Attribute Values Must be Quoted

Like HTML elements XML elements can have attributes in name/value pairs, and this attribute values must always be quoted properly.