Syntax

tutorial and example
tutorial and example

XML Syntax

Here simple syntax rules to write in XML document.

  • The first line syntax is the XML declaration. It defines the xml version and encoding used in the document.
  • Next line describes the root element of document.

<note>

  • Next 4 lines describes the child element of the root elements.

<to>Ajay</to>

<from>Arun</from>

<heading>Reminder</heading>

<body>Don’t forget Abhay birthday this weekend! </body>

  • Last lines describes the end of the root element.

</note>

It is case sensitive and begin with “<?xml>” where xml is written in lower case.

Example of XML: Movie

File: movie.xml

The root element in the example is <Movies-store>. All elements in the document are contained within <Movies-store>.

The <Movie> element has 4 children: <title>, < director>, <year> and <budget>.

Example of Email

File: email.xml