2. Core XML / Chapter 1 / Slide 2 of 352
Chapter Objectives -1
Discuss markup language
List and explain drawbacks of HTML
Discuss the architecture of XML documents
List the benefits of XML
3. Core XML / Chapter 1 / Slide 3 of 353
Chapter Objectives -2
Build a complete XML Document:
The DOCTYPE Declarations
4. Core XML / Chapter 1 / Slide 4 of 354
History of Markup
using paper and pen
Tools used by typesetters
to format a document
5. Core XML / Chapter 1 / Slide 5 of 355
A Markup language defines the rules that help to add
meaning to the content and structure of documents.
They are classified as:
Stylistic Markup – It determines the presentation of the
Structure Markup – It defines the structure of the
Semantic Markup – It determines the content of the
6. Core XML / Chapter 1 / Slide 6 of 356
Generalized Markup Language (GML) is the
system of formatting documents.
GML was fine-tuned and came to be known
as Standard Generalized Markup Language
SGML is the source of origin of all markup
7. Core XML / Chapter 1 / Slide 7 of 357
Features of SGML
It describes markup language, which allows
authors to create their own tags that relate to
It needs a separate file that will contain all
the rules for the language, for its
A SGML application is markup language
derived from SGML.
8. Core XML / Chapter 1 / Slide 8 of 358
HTML is the most famous markup language derived
It was created to mark up technical papers so that
they could be transferred across different platforms
for the scientific community.
It is now also used by those non-scientific users who
are concerned about their document’s presentation.
9. Core XML / Chapter 1 / Slide 9 of 359
Drawbacks of HTML
Fixed tag set
Presentation technology does not relate to the
It is flat
HTML is not international
Data interchange is impossible
Does not have a robust linking mechanism
HTML is not reusable
10. Core XML / Chapter 1 / Slide 10 of 3510
HTML and XML code Examples
<LI> TOM CRUISE
<LI> CLIENT ID : 100
<LI> COMPANY : XYZ Corp.
<LI> Email : firstname.lastname@example.org
<LI> Phone : 3336767
<LI> Street Adress: 25th
<LI> City : Toronto
<LI> State : Toronto
<LI> Zip : 20056
<ID> 100 </ID>
<Company>XYZ Corp. </Company>
<Phone> 3336767 </Phone>
<Street> 25th St. </Street>
<City> Toronto </City>
<State> Toronto </State>
<ZIP> 20056 </ZIP>
HTML Code XML Code
11. Core XML / Chapter 1 / Slide 11 of 3511
XML stands for Extensible Markup Language.
It overcomes all the drawbacks of HTML.
It allows the user to define their own set of tags, and also
makes it possible for others (people or programs) to
It is more flexible than HTML.
It inherits the features of SGML and combines it with the
features of HTML.
It is a smaller version of SGML.
12. Core XML / Chapter 1 / Slide 12 of 3512
XML is a metalanguage and it describes other
The data contained in an XML file can be displayed
in different ways.
It can also be offered to other applications for further
Style sheets help transform structured data into
different HTML views. This enables data to be
displayed on different browsers.
13. Core XML / Chapter 1 / Slide 13 of 3513
XML Architecture - 1
XML supports three-tier architecture for handling
and manipulating data.
It can be generated from existing databases using a
scalable three-tier model.
XML tags represent the logical structure of data that
can be interpreted and used in various ways by
The middle-tier is used to access multiple databases
and translate data into XML.
14. Core XML / Chapter 1 / Slide 14 of 3514
XML Architecture -2
15. Core XML / Chapter 1 / Slide 15 of 3515
XML – A Universal data format
HTML is a single markup language, but XML is a
family of markup languages.
Any type of data can be easily defined in XML.
XML is popular because it supports a wide range of
applications and is easy to use.
XML has a structured data format, which allows it to
store complex data
16. Core XML / Chapter 1 / Slide 16 of 3516
Benefits of XML
The three-tier architecture has easier
scalability and better security.
The benefits of XML are classified into the
17. Core XML / Chapter 1 / Slide 17 of 3517
Allows businesses to define data formats in XML
Provides tools to read, write and transform data between
XML and other formats
XML inside a single application:
Powerful, flexible and extensible language
Supports different users and channels, like digital TV,
phone, web and multimedia kiosks
18. Core XML / Chapter 1 / Slide 18 of 3518
Re-use of data
Separation of data and
19. Core XML / Chapter 1 / Slide 19 of 3519
XML Document Structure
An XML document is composed of sets of “entities”
identified by unique names.
All documents begin with a root or document entity.
Entities are aliases for more complex functions.
Documents are logically composed of declarations,
elements, comments, character references, and
20. Core XML / Chapter 1 / Slide 20 of 3520
Well formed and Valid Documents
An XML document is considered as well formed, if a
minimum set of requirements defined in the XML
1.0 specification are satisfied.
The requirements ensure that correct language terms
are used in the right manner .
A valid XML document is a well-formed XML
document, which conforms to the rules of a
Document Type Definition (DTD).
DTD defines the rules that an XML markup in the
XML document must follow.
21. Core XML / Chapter 1 / Slide 21 of 3521
Parsers - 1
Parsers help the computer interpret an XML
Editor with the
viewed in the browser
XML document parsed by the
Their are two types of parsers:
Non Validating parser
22. Core XML / Chapter 1 / Slide 22 of 3522
Parsers - 2
files (like DTD
Parsers load the XML
and other related files
to check whether the
XML document is well
formed and valid
23. Core XML / Chapter 1 / Slide 23 of 3523
Data versus Markup
<NAME> Tom Cruise </NAME>
24. Core XML / Chapter 1 / Slide 24 of 3524
Creating an XML Document
To create an XML document:
State an XML declaration
Create a root element
Create the XML code
Verify the document
25. Core XML / Chapter 1 / Slide 25 of 3525
Stating an XML Declaration
<?xml version=“1.0” standalone=“no” encoding=“UTP-8”?>
‘Standalone’ and ‘encoding’ attributes are
optional, only the version number is mandatory
‘Standalone’ – is the external declaration
‘Encoding’ - specifies the character encoding
used by the author
XML 1.0 version is default
26. Core XML / Chapter 1 / Slide 26 of 3526
Creating a Root Element
There can only be one root element
It describes the function of the document
Every XML document must have a root
<?xml version=“1.0” standalone=“no” encoding=“UTP-8”?>
27. Core XML / Chapter 1 / Slide 27 of 3527
Creating the XML Code -1
It is the process of creating our own elements
and attributes as required by our application.
Elements are the basic units of XML content.
Tags tell the user agent to do something to the
content encased between the start and end tag.Opening Tag Content Closing Tag
<TITLE> Aptech Ltd </TITLE>
Parts of an
28. Core XML / Chapter 1 / Slide 28 of 3528
Creating the XML Code -2
Rules govern the elements:
At least one element required
XML tags are case sensitive
End the tags correctly
Nest tags Properly
Use legal tags
Length of markup names
Define Valid Attributes
29. Core XML / Chapter 1 / Slide 29 of 3529
Verify the document
The document should follow the
XML rules; otherwise it will not be
read by the browser or by any other
30. Core XML / Chapter 1 / Slide 30 of 3530
This is information for the understanding of
the user, and is to be ignored by the
<!- - Write the comment here -- >
<!-- don't show these
The example given will
display only the name TOM
CRUSIE, and others are
treated as comments.
31. Core XML / Chapter 1 / Slide 31 of 3531
A processing information is a bit of information meant
for the application using the XML document.
These instructions are directly passed to the application
using the parser.
The XML declaration is also a processing agent.
Name of application Instruction information
32. Core XML / Chapter 1 / Slide 32 of 3532
The text between the start and end tags is
defined as ‘character data’.
Character data may be any legal (Unicode).
Character data is classified into:
33. Core XML / Chapter 1 / Slide 33 of 3533
It stands for parsed character data.
PCDATA is text that will be parsed by a Parser.
Tags inside the text will be treated as markup and
entities will be expanded.
Entity Name Character
34. Core XML / Chapter 1 / Slide 34 of 3534
It means character data.
It will not be parsed by the Parser.
CDATA are used to make it convenient to include
large blocks of special characters.
The character string ]]> is not allowed within a
CDATA block as it will signal the end of the CDATA
35. Core XML / Chapter 1 / Slide 35 of 3535
Entities are used to avoid typing long pieces of text
repeatedly within a document.
There are two categories of entities:
<!ENTITY ADDRESS "text that is to be represented
by an entity">
<!ENTITY % ADDRESS "text that is to be represented by an entity">
36. Core XML / Chapter 1 / Slide 36 of 3536
Examples of Entities
An example of Parameter entities
< CLIENT = "&APTECH;" PRODUCT
= "&PRODUCT_ID;" QUANTITY
An example of a General entity
<!ENTITY full_address " My
Address 12 Tenth Ave. Suite 12
37. Core XML / Chapter 1 / Slide 37 of 3537
The DOCTYPE declarations
The <!DOCTYPE [..]> declaration follows the XML
declaration in an XML document.
<!DOCTYPE myDoc [
...declare the entities here....
...body of the document....
<!DOCTYPE CUSTOMERS [
<!ENTITY firstFloor "15 Downing St Floor 1">
<!ENTITY secondFloor "15 Downing St Floor 2">
<!ENTITY thirdFloor "15 Downing St Floor 3">
38. Core XML / Chapter 1 / Slide 38 of 3538
An attribute gives information about an
Attributes are embedded in the element start
An attribute consists of an attribute name
and attribute value.
39. Core XML / Chapter 1 / Slide 39 of 3539
A markup language defines a set of rules that adds
meaning to the content and structure of documents
XML is extensible, which means that we can define our
own set of tags, and make it possible for other parties
(people or programs) to know and understand these tags.
This makes XML much more flexible than HTML
XML inherits features from SGML and includes the
features of HTML. XML can be generated from existing
databases using a scalable three-tier model. XML-based
data does not contain information about how data should
An XML document is composed of a set of “entities”
identified by unique names
40. Core XML / Chapter 1 / Slide 40 of 3540
A well-formed document is one that conforms to the basic
rules of XML; a valid document is a well-formed
document that conforms to the rules of a DTD (Document
The parser helps the computer to interpret an XML file
Steps involved in the building of an XML document are:
Stating an XML declaration
Creating a root element
Creating the XML code
Verifying the document
Character data is classified into PCDATA and CDATA
41. Core XML / Chapter 1 / Slide 41 of 3541
Entities are used to avoid typing long pieces of text repeatedly
in a document. The two types of entities are:
The <!DOCTYPE […]> declaration follows the XML
declaration in an XML document.
An attribute gives information about an element