XML Syntax

xml-Logo
XML Tutorials

XML syntax is a set of rules that defines the combinations of symbols that are considered to be a correctly structured XML document or fragment. This lesson describes how to write XML syntax.

XML Example:
<?xml version="1.0" encoding="UTF-8" ?>
<address>
  <name>Alex</name>
  <company>w3schools</company>
  <phone>(091) 123-4567</phone>
</address>

In the above example, employee information is stored in XML.

XML Tag

Syntax:
<name>Alex</name>
  • XML tags are surrounded by the two characters < and >.
  • The start tag is often called the opening tag, and the end tag is often called the closing tag.
  • All XML elements must have a closing tag.
  • XML tags must be closed in the proper order.
  • XML Tags are Case Sensitive.
  • The text between the start and end tags is the data.

XML Start Tag

Syntax:
<name>

XML End Tag

Syntax:
</name>

Empty XML Tag

Syntax:
<name></name>