8/14/2019 XML - Lesson 1
1/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 1 of 40
Objectives
In this session, you will learn to:
Identify the limitations of EDI
Identify the need for XML as a standard data
interchange format
Identify the differences between SGML, HTML, and
XML
Identify the role of World Wide Web Consortium
(W3C) in defining XML-related specifications
Create an XML document
8/14/2019 XML - Lesson 1
2/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 2 of 40
What is Electronic Data Interchange
EDIrefers to the process of exchanging documents in
a standard format between two computer systems.
EDI is often used as a replacement for conventional
business documents such as purchase orders,
requests for quotations, invoices, and shipping
notices.
8/14/2019 XML - Lesson 1
3/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 3 of 40
How Does EDI Work (Contd.)
The sender of information uses computer files toassemble the data needed for a transaction.
The assembled data is the input to a software modulethat transforms the transaction into the EDI standardformat.
The resulting data file generated by the software
module is transmitted to the receiver via anintermediate channel company known as Value
Added Network (VAN).
This data file is treated as the input at the receiving
end in which a software module translates the datafrom the EDI format into a file that can be understoodby the receivers application system.
8/14/2019 XML - Lesson 1
4/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 4 of 40
How Does EDI Work (Contd.)
The above process includes a number of security
procedures. Data security is maintained with the help
of user identification numbers and passwords.
The EDI standards also allow a receiver to send an
acknowledgement message to the sender indicating
successful receipt of information.
8/14/2019 XML - Lesson 1
5/40
8/14/2019 XML - Lesson 1
6/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 6 of 40
Hardware and Software Requirements forImplementing EDI
For implementing EDI, you require EDI software and a
modem (minimum 28.8k baud, 56k baudrecommended).
You need to convey transactions to and from yourtrading partners electronically.
This can be done either using the point-to-pointcommunication method or using a VAN as anintermediary between various trading partners.
In the point-to-point communication method, you use
a telephone line to dial your trading partnerscomputer directly.
8/14/2019 XML - Lesson 1
7/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 7 of 40
Benefits of EDI
Reduction in data entry errors
Elimination of communication lag time between anagency and a customer
Improved customer service
Minimized costs of transferring information
Reduced order time
8/14/2019 XML - Lesson 1
8/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 8 of 40
Limitations of EDI
The limitations of EDI are as follows:
Rigid Transaction Set
Fixed Business Rules
High Costs
Slow Pace of Standards Evolution
8/14/2019 XML - Lesson 1
9/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 9 of 40
Introduction to XML
What is XML
eXtensible Markup Language (XML) is a text-basedmarkup language that enables you to store data in a
structured format by using meaningful tags.
The term "eXtensible" implies that you can extend your
ability to describe a document by defining meaningfultags for your application.
XML is a cross-platform, hardware, and software
independent markup language.
XML can be used to address the problems faced by
EDI.
8/14/2019 XML - Lesson 1
10/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 10 of 40
Introduction to XML
Advantages of XML over EDI
Some of the advantages of XML over EDI are listedbelow:
Lower Cost
XML does not require a high priced VAN as in the
case of EDI.
Customized Business Rules
XML enables you to store data in a structured
format by allowing you to create customized tags.
8/14/2019 XML - Lesson 1
11/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 11 of 40
Advantages of XML over EDI (Contd.)
Easy to Interpret
XML documents can be easily interpreted by thetarget systems by using aparser.
Platform Independent
As XML documents are platform independent, a
business unit can have transactions with any other
business unit irrespective of their data storage
platform.
8/14/2019 XML - Lesson 1
12/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 12 of 40
Difference between SGML, HTML, and XML
A markup language uses tags to indicate how a file
should look when displayed on a Web page.
Some examples of markup languages are Standard
Generalized markup language (SGML) and Hypertext
Markup Language (HTML).
SGML allows documents to describe their owngrammar by specifying the tag set used in the
document and the structural relationship that these tags
represent.
SGML was complex and difficult for developers tomaster.
8/14/2019 XML - Lesson 1
13/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 13 of 40
Difference between SGML, HTML, and XML
(Contd.)
HTML is based on SGML.
In HTML, a user has to work with a set of predefined
tags that is understood by the browser.
XML is a subset of SGML.
HTML is used for data presentation, whereas XML is
used for data description and definition. Thus, the
purpose of these two markup languages is completely
different.
8/14/2019 XML - Lesson 1
14/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 14 of 40
Advantages of XML
The advantages provided by XML are as follows:
Domain Specific Vocabulary
Data Interchange
Smart Searches
Granular Updates
User-Selected View of Data
8/14/2019 XML - Lesson 1
15/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 15 of 40
Introduction to World Wide Web Consortium
W3C is responsible for the development of Webspecifications (recommendations) that describe
communication protocols and the technologies for theWeb.
Role of W3C in defining XML related specifications
W3C has laid down certain rules that need to be
followed by all XML applications. Listed below aresome of these rules:
XML must be directly usable over the Internet.
XML must support a wide variety of applications.
XML must be compatible with SGML.
8/14/2019 XML - Lesson 1
16/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 16 of 40
Introduction to World Wide Web Consortium
(Contd.)
The number of optional features in XML needs
to be kept to the absolute minimum, ideallyzero.
XML documents must be human-legible and
clear.
XML design must be formal and concise.
8/14/2019 XML - Lesson 1
17/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 17 of 40
Problem Statement 1.D.1
CyberShoppe requires a centralized repository of data
about the products sold through its e-commerce site.
It has three branches, which maintain data on theirlocal computer systems. Data from all the three
branches must be collated and housed in a
centralized location. This data must be made available
to the Accounts and Sales sections of these branches,regardless of the hardware and software platforms
being used at the branches. The sales personnel also
require access to the data using equipment, such as
palmtops and cellular phones.
8/14/2019 XML - Lesson 1
18/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 18 of 40
Problem Statement 1.D.1 (Contd.)
The product details of CyberShoppe consist of the
name of the product, a brief description of the product,
the price, and the available quantity on hand. Eachproduct is uniquely identified by a product ID.
8/14/2019 XML - Lesson 1
19/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 19 of 40
Task List
Identify the method to store data in a device-
independent format.
Identify the structure of the document in which data is
to be stored.
Create an XML document to store data.
View the XML document in a browser.
8/14/2019 XML - Lesson 1
20/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 20 of 40
Task 1: Identify the method to store data in a
device-independent format.
Result
XML provides a way to store structured data that is
capable of being recognized by different kinds of
devices. In other words, it enables device-
independence.
8/14/2019 XML - Lesson 1
21/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 21 of 40
Task 2: Identify the structure of the document inwhich data is to be stored.
Before you store data in an XML document, you need
to organize it. An XML document is composed of a number of
components that can be used for representinginformation. These components are:
Processing InstructionAn XML document usually begins with the XML
declaration statement or the ProcessingInstruction (PI).
The PI provides information regarding the wayin which the XML file should be processed.
8/14/2019 XML - Lesson 1
22/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 22 of 40
Task 2: Identify the structure (Contd.)
The PI statement can be written as:
In the above example, the PI states that version
1.0 is used.
The PI uses the encoding property to specifyinformation about the encoding scheme that is
used to create the XML file.
8/14/2019 XML - Lesson 1
23/40
8/14/2019 XML - Lesson 1
24/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 24 of 40
Task 2: Identify the structure (Contd.)
Elements
Elements are the basic units that are used to
identify and describe data in XML.
They are the building blocks of an XML
document.
Elements are represented using tags.
An XML document must always have a root
element. All other elements are specified within
the opening and closing tags of the root
element.
8/14/2019 XML - Lesson 1
25/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 25 of 40
Task 2: Identify the structure (Contd.)
Content
The information that is represented by the
elements of an XML document is referred to as
the content of that element.
8/14/2019 XML - Lesson 1
26/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 26 of 40
Task 2: Identify the structure (Contd.)
An element can contain any of the following:
Character or Data Content
Elements can contain only textual
information.
Element Content
Elements can contain other elements.
The elements contained in another
element are called child elements.
The containing element is called the
parent element.
8/14/2019 XML - Lesson 1
27/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 27 of 40
Task 2: Identify the structure (Contd.)
Element Content
A parent element can contain many child
elements.
All the child elements of a parent element
are siblings and are thus related to one
another.Combination
Elements can contain textual information
as well as other elements.
8/14/2019 XML - Lesson 1
28/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 28 of 40
Task 2: Identify the structure (Contd.)
Attributes
Attributes provide additional information about
the elements for which they are declared.
An attribute consists of a name-value pair.
Elements can have one or more attributes.Attributes or attribute values can be eithermandatory or optional.
8/14/2019 XML - Lesson 1
29/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 29 of 40
Task 2: Identify the structure (Contd.)
Attributes
While deciding whether to represent information
as an element or an attribute, you can follow theguidelines given below:
If the data must be displayed, you canrepresent it as an element. In general,
element attributes are used for intangible,abstract properties such as ID.
If the data must be updated frequently, it isbetter represented as an element because it
is easier to edit elements than attributes withXML editing tools.
8/14/2019 XML - Lesson 1
30/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 30 of 40
Task 2: Identify the structure (Contd.)
If the value of a piece of information must be
checked frequently, it may be represented as
an attribute.
8/14/2019 XML - Lesson 1
31/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 31 of 40
Task 2: Identify the structure (Contd.)
Entities
An entity can be described as a short cut to a
set of information.
It is a name that is associated with a block of
data.
This data can be a chunk of text or a referenceto an external file that contains textual or binary
information.
XML supports the use of three kinds of entities:
internal, general, and parameter entities.
8/14/2019 XML - Lesson 1
32/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 32 of 40
Task 2: Identify the structure (Contd.)
Internal Entities
An internal entity consists of a name that is
associated with a block of information.
This can be identified easily as it is always
preceded by an ampersand (&) symbol and
terminated with a semicolon.
8/14/2019 XML - Lesson 1
33/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 33 of 40
Task 2: Identify the structure (Contd.)
Comments
Comments are statements that are used to
explain the code.
When the code is executed, comment entries
are ignored by the parser.
Comments are not essential in an XML file.
8/14/2019 XML - Lesson 1
34/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 34 of 40
Task 2: Identify the structure (Contd.)
Result
Structure of the XML document to be used for storing
products data:
PRODUCT
PRODUCTNAME
DESCRIPTION
PRICE
QUANTITY
PRODUCTDATA
8/14/2019 XML - Lesson 1
35/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 35 of 40
Task 3: Create an XML document to store data.
Rules for Creating Well-formed XML Documents
Every start tag must have an end tag.
Empty tags must be closed using a forward slash
(/).
All attribute values must be given in double
quotation marks.
Tags must nest correctly.
XML tags are case-sensitive. They must match
each other in every implementation.
L i XML B i
8/14/2019 XML - Lesson 1
36/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 36 of 40
Task 4:View the XML document in a browser.
L i XML B i
8/14/2019 XML - Lesson 1
37/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 37 of 40
Problem Statement 1.P.1
The details of books sold by CyberShoppe need
to be stored at a centralized location. This data
needs to be made available to the variousbranches of CyberShoppe, regardless of the
platforms used at various branches. The book
details consist of the title of the book, the first and
last names of the author of the book and the priceof the book. Each book is uniquely identified by a
book ID.
L i XML B i
8/14/2019 XML - Lesson 1
38/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 38 of 40
Summary
In this lesson you learned that,
EDI is a standard format used for the exchange of
business data among heterogeneous systems.
XML is a text-based markup language that enables
you to store data in a structured format using
meaningful tags. XML is a method of storing data in a device-
independent format.
HTML and XML are subsets of SGML.
L i XML B i
8/14/2019 XML - Lesson 1
39/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 39 of 40
Summary (Contd.)
An XML document consists of:
Processing Instructions
Elements
Attributes
Entities Comments
Content
Learning XML Basics
8/14/2019 XML - Lesson 1
40/40
Learning XML Basics
NIIT eXtensible Markup Language/Lesson 1/Slide 40 of 40
Summary (Contd.)
The rules that govern the creation of a well-formed
XML document are as follows:
Every start tag must have an end tag.
Empty tags must be closed using a forward slash
(/).
All attribute values must be given in doublequotation marks.
Tags must nest correctly.
XML tags are case-sensitive. They must matcheach other in every implementation.