XML Tutorial

XML HOME XML Introduction XML How to use XML Tree XML Syntax XML Elements XML Attributes XML Namespaces XML Display XML XSLT XML XPath XML XLink XML Validator XML DTD XML Schema XML Server XML HttpRequest XML Parser XML Examples XML Quiz XML Certificate


AJAX Intro AJAX XMLHttp AJAX Request AJAX Response AJAX XML File AJAX PHP AJAX ASP AJAX Database AJAX Applications AJAX Examples


DOM Intro DOM Nodes DOM Accessing DOM Node Info DOM Node List DOM Traversing DOM Navigating DOM Get Values DOM Change Nodes DOM Remove Nodes DOM Replace Nodes DOM Create Nodes DOM Add Nodes DOM Clone Nodes DOM Examples

XSLT Tutorial

XSLT Intro XSL Languages XSLT Transform XSLT <template> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XSLT Apply XSLT on the Client XSLT on the Server XSLT Edit XML XSLT Examples

XPath Tutorial

XPath Intro XPath Nodes XPath Syntax XPath Axes XPath Operators XPath Examples

XQuery Tutorial

XQuery Intro XQuery Example XQuery FLWOR XQuery HTML XQuery Terms XQuery Syntax XQuery Add XQuery Select XQuery Functions


DTD Intro DTD Building Blocks DTD Elements DTD Attributes DTD Elements vs Attr DTD Entities DTD Examples

XSD Schema

XSD Intro XSD How To XSD <schema> XSD Elements XSD Attributes XSD Restrictions

XSD Complex

XSD Elements XSD Empty XSD Elements Only XSD Text Only XSD Mixed XSD Indicators XSD <any> XSD <anyAttribute> XSD Substitution XSD Example

XSD Data

XSD String XSD Date XSD Numeric XSD Misc XSD Reference

Web Services



DOM Node Types DOM Node DOM NodeList DOM NamedNodeMap DOM Document DOM Element DOM Attribute DOM Text DOM CDATA DOM Comment DOM XMLHttpRequest DOM Parser XSLT Elements XSLT/XPath Functions

Introduction to XML

XML is a software- and hardware-independent tool for storing and transporting data.

Why Study XML?

XML plays an important role in many IT systems.

For this reason, it is important for all software developers to have a good understanding of XML.

Before you continue, you should also have a basic understanding of:

  • HTML
  • JavaScript

If you want to study these subjects first, find the tutorials on our Home page.

What is XML?

  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to store and transport data
  • XML was designed to be self-descriptive
  • XML is a W3C Recommendation

XML Does Not DO Anything

Maybe it is a little hard to understand, but XML does not DO anything.

This note is a note to Tove, from Jani, stored as XML:

  <body>Don't forget me this weekend!</body>

The note is quite self-descriptive. It has sender and receiver information. It also has a heading and a message body.

But still, this XML document does not DO anything. XML is just information wrapped in tags. Someone must write a piece of software to send, receive, store, or display it:


To: Tove

From: Jani


Don't forget me this weekend!

The Difference Between XML and HTML

XML and HTML were designed with different goals:

  • XML was designed to carry data - with focus on what data is
  • HTML was designed to display data - with focus on how data looks
  • XML tags are not predefined like HTML tags are

XML Does Not Use Predefined Tags

The XML language has no predefined tags.

The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are "invented" by the author of the XML document.

HTML works with predefined tags like <p>, <h1>, <table>, etc.

With XML, the author must define both the tags and the document structure.

XML is Extensible

Most XML applications will work as expected even if new data is added (or removed).

Imagine an application designed to display the original version of note.xml (<to> <from> <heading> <data>).

Then imagine a newer version of note.xml with added <date> and <hour> elements, and a removed <heading>.

The way XML is constructed, older version of the application can still work:

  <body>Don't forget me this weekend!</body>


To: Tove

From: Jani

Head: Reminder

Don't forget me this weekend!


To: Tove

From: Jani

Date: 2015-09-01 08:30

Head: (none)

Don't forget me this weekend!

XML Simplifies Things

  • It simplifies data sharing
  • It simplifies data transport
  • It simplifies platform changes
  • It simplifies data availability

Many computer systems contain data in incompatible formats. Exchanging data between incompatible systems (or upgraded systems) is a time-consuming task for web developers. Large amounts of data must be converted, and incompatible data is often lost.

XML stores data in plain text format. This provides a software- and hardware-independent way of storing, transporting, and sharing data.

XML also makes it easier to expand or upgrade to new operating systems, new applications, or new browsers, without losing data.

With XML, data can be available to all kinds of "reading machines" like people, computers, voice machines, news feeds, etc.

XML is a W3C Recommendation

XML became a W3C Recommendation on February 10, 1998.