XML from Beginner to Expert

You will discover how to create and read XML files starting from simple and ending with complex structure file
3.9 (10 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
195 students enrolled
Instructed by Daniele Protti IT & Software / Other
75% off
Take This Course
  • Lectures 94
  • Length 4 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 1/2016 English

Course Description

A complete video tutorial to understand and write your own XML files, create amazing web services and manage your information within your organization and also in connection with other external entities and partners.

Basically the course contains:



Organization of the course

The Overview of XML


Example of An XML document

Basic Rules




The XML Syntax

Structure of an XML document

Components of an XML document

Elements of an XML document

Nesting of elements

Tag naming

Tag attributes

Predefined entities

The DTD Grammars

The DTD Grammars

Validation Tools

Define Your First Grammar

Internal and External Grammars

More documents for the same Grammar

The Basis of XML Grammars

DTD and Entities

DTD and Entities

Syntax of the internal Entities

Syntax of the external Entities

Syntax of the parametrical Entities

DTD and Attributes

Syntax of attributes

Attributes in the DTD grammars

Type of Attributes and Modifiers



The namespaces

The namespaces

Why the XML namespaces

Use the XML namespaces

Syntax of the namespaces

Attributes and namespaces

Use the XML namespaces

Namespaces and DTD grammars

An application of namespaces

Transform with XSLT

Transform with XSLT

Example of XSLT Transformation

2nd Example of XSLT Transformation


Formatting with XSL:FO

The formatting process


2nd Example - more complex


How to use XPath

Patterns for the match attribute

Patterns for the select attribute

XLink and XPointer

XLink and XPointer


Simple use of XLink

Complex links


Example of use of XPointer

XML and the Web: XHTML

What’s XHTML

The basic XHTML syntax

The validation process

TEI - XML and text encoding


Structure of a TEI-Lite document

Transform a TEI-Lite document




What are the requirements?

  • an advantage is to know some basic HTML
  • be familiar with computers and the Internet

What am I going to get from this course?

  • create XML documents
  • validate XML documents
  • create or interface with XML web services
  • use XML files to store and read data
  • create DTD grammars for XML documents
  • Access XML data with XPath
  • Generate RSS feeds
  • Use MathML for online academic presentations
  • recognize the structure of an XML document
  • understand and create XHTML files

Who is the target audience?

  • Basic knowledge of HTML and Javascript is recommended
  • familiarity with Windows or Mac computers
  • Who is familiar with computers and the Internet
  • Basic knowledge of programmin languages is an advantage in case you want to read or write data to/from an XML file using a program written in Java, C, C++, VB, PHP, etc.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction
About the author
Welcome to the Course - Introduction

Although it is defined as a language, in reality it is NOT. It is a set of rules and conventions to define any markup language (based on markups).

With XML you can define your own language and the hierarchical relationships between the components.

With XML you can extend your language.

Section 2: The Overview of XML

XML has become one of the fundamental elements for the implementation of information systems, independently from the technology and the used architecture

In this lesson we will see why XML is important and when it is to be used.

  • The markup languages allow to describe with precision any kind of information (hierachical, relational or binary
  • In XML the information is organized according to a hierarchical structure which you can easily scroll down and browse where the needed information can be retrieved
  • HTML is one of the most known markup language (to create web pages)

In this example we will understand what tags are in XML and how to use them.

We will understand the hierarchical structure of an XML document and how it is displayed in an Internet browser


In order to understand the basic rules of an XML document,despite its content, we will first analyze an example.

We will give an informative structure assigning meaningful names to the tag.

The example contains information to describe a organizational structure in a generic business company.


Nesting is one of the most important concept when structuring an XML document.

The objects representing the information are inserted one within the other, when this is meaningful from the logical point of view, through the nesting process.


XML tags, as in any markup language, are associated to attributes which explain better some characteristic.

Attributes are couples name=“value” which must be inserted within the tag.


We will see the most important definitions to be used when structuring an XML document.

We will concept e.g.:

  • Compliance
  • Validation
  • Grammar

and we will see when an XML is valid and what valid means

Section 3: The XML Syntax

XML Syntax is the set of sintatic rules to respect to have a well formed XML document.

In this lesson we will talk about the XML Syntax starting from the structure of an XML document.

An XML document is a container of information characterized by a hierarchical logical structure which can contain any type of object (flat, relational, binary or as object).


In this lesson we will see what a prologue is in an XML file and when it has to be included.

In this lesson we will see what the XML declaration is and how it is done in an XML file.

The Elaboration instructions are directives to give guidelines to the applcation using the XML document.


An XML document can be associated to grammar rules.
The grammar rules describe the semantic aspects of an XML document.

We will see how to set the information about the Grammar into an XML document.


We will see how to specify comments into an XML document.

Comments are additional information which can provide explanation about what is in an XML document.


We will see the defintion of the elements in an XML document and also some examples where elements are used.

An XML document is composed of a hierarchy of elements which can be nested at wish according to precise sintactic rules.


We will see how to define the most important and external element in an XML document: the root element


After the overview of the elements in an XML document we will see how to generate nesting of elements


We will see how we can name elements in XML and which naming convention is available for XML.

We will see which names are allowed and which not.


Sometimes some information of an element instead of being specified in a child element can be expressed as its specification. attributes to be associated to the markup of the elements.

Using attributes it is possible to better specify some characteristics or behaviours of the element.

We will see how to do this in this lesson.


As for the elements there are specific naming conventions also for the attributes.

This is explained in this lesson.


In this lesson we will see how to set the values of the attributes of elements in an XML document


In XML there are special markups which are called entities.

An entity, in general, is a way to insert into an XML document a piece of text to be analyzed only during the elaboration phase of the XML document.

It is therefore not considered during the analisys of the form of the document.

We will see the main predefined entities in XML.

Section 4: The DTD Grammars

Well formed XML documents are those compliant to the XML syntax as described in the specifications

XML documents must contain the information in such a way to be elaborated in automatic way.

At this aim syntactic rules alone are not enough.

We need also to define a grammar to identify the allowed elements, their number, their attributes, what is optional and what is mandatory, etc.


Validation can be performed through several tools available on the market.

Some of them are very complex tools including many functions to study and generate grammars, and to validate and transform XML documents.

A list of some of popular validation tools will be shown in this lesson.


To define a Grammar it is necessary to know and understand what we need to represent with our XML document.compliant to in order to produce what we are aiming.

We will start with the organization of the information and define our first Grammar.


We saw that we can insert a grammar in an XML document.

We already said that we can specify a grammar within an external file (extension “.dtd”).

This is a flexible way as you can refer more than one XML document to this file if you are using the same grammar.

In this lesson we will see what happens to our example when we move the grammar to an external document.


We just understood the principles of XML grammars and their relationships with the XML documents.

We will see in details some sintactic elements to produce XML grammars.


The grammar structure of a document is a portion of code which must satisfy some important sintactic rules.

Everything is linked to the concept of document type, which the grammar represents the definition.

A grammar describes a document type as all the XML documents which respect that grammar have structural characteristics in common.

Thus these documents are of the same type.

As we already saw an XML element can contain:
  • Textual information
  • Other elements
  • Textual information and other elements
  • Nothing (the empty element)

Each of these situations can be described with the grammar rules of the DTD grammars.

We will see this in this lesson.


We already said that the root element and the document type must have the same name.

We will see how to define the Grammar for the root element.


An XML document is a container of information organized hierarchically.

The hierarchy is described by the DTD grammars.

In this way the XML document is validated for its structure.

We will see how to do this with the hlep of the Nesting concept.


The rules describing the sorting order are very rigid.

It can be useful to have elements with a non pre-defined number of child elements.

It can be useful to have more than one instance for child element.

This is done defining the allowed number of elements in the Grammar.


You may need to choose only one element in a pre-defined list.

In this case the sintactic elements are no more enough.

In this lesson we will see how to do this.


In this lesson we will see how to define elements of mixed content in an XML document


Sometimes you might need to define elements which you do not decide the content type yet.

This is useful to have less constraints during the analysis.

This means to define a rule which specify for an element to contain any information (text or list of sub-elements).

We will see how to do this in this lesson.


We already know that in XML we can have elements without content.
The information of these is represented by the presence of the element itself.
No further information is needed.
We will see how to do this in this lesson.


A sequence allows to decide everything about the content of an element:

  • Which elements can be present
  • If textual data can be present
  • In which order the elements must be inserted
  • In which number
  • If they are mandatory or optional

We will see how to define a sequence in XML in this lesson.

Section 5: DTD and Entities

In this lesson we will see:

  • What an entity is
  • How to create grammar using entities to represent in modular way the information within the XML document

The entities are declared in the grammar and are then used in the XML document.

We will see in this lesson how to declare an entity (the syntax).


Also external entities can be defined.
External entities are contained in XML documents or grammars but in separated documents.
We will see in this lesson how to define an external entity.


We just saw entities which are defined in DTD grammars and then are inserted in the XML code to be substituted with the value associated to the entity.
In case you may need to have the same result within the DTD grammar.
It is possible to use the parametric entities defined and used directly in the DTD grammar.
We will understand the concept of parametric DTD analyzing one example of an XML document referring to an internal DTD grammar.

Section 6: DTD and Attributes

Generating a grammar we need to consider the attributes that are present in the XML document.
If we do not do this and try to validate the XML document the result will be negative.
In fact, in the grammar we missed out the definition of the attributes of the elements.
We need to describe any attribute in any element of a XML document in the associated grammar.
We will see how to do this in this lesson.


The attributes are associated to a type to explain to the XML parser which information they can memorize.
In this lesson we will see a list of possibile types to be associated to attributes.


Enumerations are attributes for which a real type is not defined in the grammar, but a list of possible values.
If the attribute present in the XML document is associated to one of the values provided by the grammar.
Then the document can be valid.
In case we use an attribute not included in the list, the document could not be validated.


The type of data NMTOKEN identifies a typical XML name.
We will see the rules indicated by the NMTOKEN attribute.
Another type of values associable to the XML attributes is NMTOKENS.
With NMTOKENS you define a list of values of the NMTOKEN type.
When using NMTOKENS it is natural to think that the value of the attribute is a list of names where every single element follows the naming rules defined before.

Section 7: The Namespaces

Using complex and sofisticated structures can introduce problems, especially if we are going to use more grammars, also produced by third parties.
We can solve this issue using the namespace.
We will see how to do this in this lesson.


Starting from an example of XML document created with the contribution of 2 different teams we will understand the importance of namespaces for XML.


We will see how to use the namespaces starting from the previous examples of XML documents.


In this lesson we will see the syntax of the namespaces in XML.


Attributes are also defined for the XML namespaces.

We will see how to define attributes for a namespace.


The presence of DTD grammars and the the requisite to validate the XML documentnis delicate when using the namespaces.
We will see how to validate an XML document using a grammar which makes reference to namespaces.


The best example to show the importance of namespaces in the XML language is the integration of a portion of MathML code within an XHTML document.

Section 8: Transform with XSLT

XSL stands for eXtensible Style Language.
It is the component of a language for the definition of style sheets.
These style sheets handle the presentation of data contained in XML documents.
In this way they can be shown correctly, e.g. In a web browser.


In this lesson we will see an example of how to use XSLT to transform an XML document in something different.


In this lesson we will complicate the structure of the previous example.
Having an XML document it is possible to apply different XSLT documents in order to obtain different results with the aim to always produce a HTML file as an output....
We will see the result of producing the transformation of the XML document.


Templates are rules that can be applied to any XML element of the source document.
They are replicated automatically for all the istances of that element.

Section 9: Formatting with XSL:FO
In this lesson we will see how to convert an XML document into one of the several formats: pdf, awt, mif, pcl, ps, txt, svg and at

In this lesson our scope is to transform an XML document into a PDF file going through the generation of the XSL:FO document using an XSL style sheet.


In this lesson starting from an XML document dealing with personal data of customers we will generate a PDF report containing all the data.

Section 10: XPath

In the 2 components of the XSL language, XSLT and XSL:FO, we need to retrieve key elements in XML documents to use to extract information useful in other environments: this is done by the special expressions of the XPath language.
XPath is a powerful and flexible language used to create expressions even complex: patterns.
Through patterns the nodes of the XML document tree can be retrieved.
XPath is a key element to retrieve information within an XML document.


To better understand XPath we will go back to the previous example.


The match attribute is typical of the <xsl:template> element used in XSL.
The scope of match is to position the XSL elaboration in a specific point of the XML document in order to be run a recurring process through all the elements.
The pattern to use has to retrieve exactly an element, or a collection of elements, within the XML document.


The select attribute is typical of all the XSL elements which have to accomplish actions of data extraction from specific elements within the XML document.

Section 11: XLink and XPointer

We always referred to one XML document, sometimes associated to a DTD grammar or transformed with a XSL stylesheet or formatted with XSL:FO, we need to talk now about the possibility to link different documents using dedicated sintactic structures.

It is the possibility to link different documents using dedicated sintactic structures.

In this way we can easily move between documents according to specific conditions.


One of the essential characteristics of the World Wide Web and of the markup language which all the services are produced with is the opportunity to create separate and autonomous documents but that can be linked together when needed.

The link, in this specific case, is the possibility to point your own navigation software towards a web page, presenting and offering to the user the opportunity to move on another page through a simple click of the mouse.


In the HTML language, when we need to insert a link to another HTML page, or in general to a resource external to the document, we use the <a> markup.
In XML, on the other hand, we cannot use predefined tags.
In fact, we know, XML does not have a dictionary of tags to use.


The syntax of the “simple” links allows good functional characteristics.
XLink allows the creation of very complex links, even with very important characteristics and functionalities.
This aspect of XLink is based on another value of the xlink:form attribute: extended.
We will see an example in this lesson.


One of the goals achieved with XPointer is the possibility to refer directly some precise areas of the XML document.
In particular it is possible to identify very precisely a certain sequence in a specific paragraph within the document and indicate it as precise destination of a link based on XLink.


In this lesson we will see an example of XPointer.

Section 12: XML and the Web: XHTML

We saw all the semantic and sintactic aspects of the XML language, it is now time to see this language operating in one of its most used expressions, the XHTML language for the Web.

The XHTML language is an application of XML which contains the re-mapping, one by one, of all the markups of the HTML language.
With XHTML it is possible to create XML documents to be viewed by the web browsers as well as for the HTML documents.


XHTML is an XML application.
As a consequence it is first of all an XML document.
So we will see in this lesson the syntax of XHTML.


We already know about the importance of the validation of an XML document when associated to a DTD grammar
This need relies on the fact that an XML document not associated to a grammar can potentially contain any element and within each element an arbitrary number of attributes can be present every attribute with a non determinable value
As the generic XML document must be used by a software, which must extract its content, it is recommended to associate that XML document to a specific grammar and has to respect it too, so that the software can verify the validity before the elaboration and eventually can interrupt it
In the case of XHTML document this factor is fundamental.
In fact the browser (the tool to view the document) might be not able to view the document correctly if this is not compliant to one of the grammars which the browser can interpret.
In this lesson we will see an example of document which should be XHTML but that is not well formed.

Section 13: TEI: XML and text encoding

There are many encoding schemes to represent the semantic structure of a certain type of documents, both in the form and in its relevant characteristics. One of these is provided by the TEI (Text Encoding and Interchange) specification

We will talk about text encoding through the use of the TEI-Lite specification

There are several schemes for text encoding Standard Generalized Markup Language) power and simplicity

One of these, good for the quality and simplicity, is provided by the TEI (Text Encoding and Interchange) specification


The goal of TEI-Lite is to provide a grammar and a set of tools to express in XML the semantic and structural organization of a tex.

We will see examples of TEI-Lite document containg text composed of a single or of a collection of works


TEI-Lite is an XML application

As a consequence a TEI-Lite document can be treated:

  • with the XSLT stylesheet
  • and with the XSL:FO transformation tools to obtain documents in other formats

We will see an example of TEI-Lite document

Section 14: XML Applications

MathML is one of the few applications made public as standards by the international organizations, many proprietary formats have been designed and written to contain information of dedicated software tools.

MathML allows to describe any mathematic expression using elements, attributes and entities - typical XML tools.

It is a must when you need to describe even complex mathematic formulas into a simple text document.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Daniele Protti, Project Manager and Software Architect

I have 20+ years experience in IT project management, software development and software architecture.

I have led several teams of software developers as project manager, quality manager and as team leader in different companies and different countries in sectors e.g. telecommunication, research & development, travel business, Internet marketing and Internet business, consultancy and services.

I have been responsible to collect the requirements of projects, applications and processes, design the databases and specify the final objects.

During my career I have accumulated a lot of experiences dealing with processes of any kind and the need to define the tools to manage them and collect the information.

Most of my tools have been written in VB, VBA, C++, C#, Java, PHP, Javascript using databases e.g. Informix, Postgres, Oracle and MySql.

I have organized all my experiences in courses which are not only a list of functions and methods but contain also my practical experiences and considerations about how to cope with the different situations and which solutions to suggest.

Ready to start learning?
Take This Course