XML Part
XML Part
Introduction
Data Structure
XML overview
XML document structure
Introduction 1/2
5
XML
1/2 Data Structure
• Data structure:
• An organization of information.
• is intended to contain data, in order to give them an
organization allowing them to simplify their
processing.
6
XML
2/2 Data Structure
• Different data structures exist:
- Table:
- Chain list:
- Tree:
7
XML
Description Languages for
structured document 1/3
⚫ The most common languages used to encode a structured
document using tags are:
8
XML
Description Languages for
structured document 2/3
⚫ SGML is a language used to specify the structure of any document. It is
understandable but it was not suitable for writing documents for the internet. It was
therefore necessary to derive the HTML language from it.[1]
⚫ XML is a derivative of SGML. It tries to be more flexible than HTML and simpler
than SGML.
9
XML
Description Languages for
structured documents3/3
Complex Syntax
SGML
Non-flexible, frozen
HTML 1996
10
XML
XML overview
12
XML
XML Tree
13
XML
Structure of a 1/8 XML document
• An XML document contains:
-a prolog.
-the element tree.
-possibly comments
14
XML
Structure of an XML 2/8 document
·Prolog
▪ describes:
- XML language version ="1.0"
- Character encoding (default UTF-8) encoding="UTF-8"
15
XML
Structure of an XML 3/8 document
• XML nodes
There are three types of XML nodes:
1 The elements
2 Attributes
3 Entities
16
XML
Structure of a 4/8 XML document
1 The elements
<category>Dessert</category>
17
XML
Structure of a 5/8 XML document
2 Attributes
18
XML
Structure of an XML 6/8 document
23 Entities
by;&entity;
• An entity is a character string starting with & and ending
19
XML
Structure of a 7/8 XML document
Predefined entities
Character Entity
& &
< <
> >
" "a;
' '
Example:
• Comments
21
XML
The syntax rules
• An XML document has a single root element.
• An element may:
▪Be empty
<empty/>
<ingredient>
<name>butter</name>
<quantity>100</quantity>
</ingredient>
version="1.0" encoding="ISO-8859-1"
standalone="yes"?> <ENGINES>
<ENGINE make = "Peugeot">
<POWER>5</POWER>
<CYLINDER>1.2</CYLINDER>
<FUEL>Gasoline</FUEL >
Attribute
</ENGINE>
<ENGINE made = "Renault">
<POWER>4</POWER>
<CYLINDER>1.3</CYLINDER>
<FUEL>Diesel & Diesel</ FUEL >
</ENGINE>
</ENGINES> Entity
23
XML
Well-formed XML document
XML
24
XML
Grammar
1 DTD
• A Document Type Definition (DTD) is a grammar used to define an XML document type
structure.
2 XSD
• XML Schema is an XML document format description language used to define the
structure and content type of an XML document.[2]
• This definition makes it possible in particular to check the validity of this document.
25
XML
Valid XML Document
XSD
27
XML
References
• [1]http://www.gchagnon.fr/cours/xml/base.html
• [2]http://fr.wikipedia.org/wiki/XML_Schem
28
XML