Wednesday, 11 February 2015

XML Basics Learning

 

Objectives

In this page you will see 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

 

 

What is Electronic Data Interchange

* EDI refers 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.

 

How Does EDI Work (Contd.)

* The sender of information uses computer files to assemble the data needed for a transaction.

* The assembled data is the input to a software module that transforms the transaction into the EDI standard format.

* The resulting data file generated by the software module is transmitted to the receiver via an intermediate 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 data from the EDI format into a file that can be understood by the receiver’s application system.

 

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.

 

EDI Standards

* Two standards of EDI are used widely.

* They are ANSI X12 and UN/EDIFACT.

* ANSI X12 is the most widely used EDI standard in the United States.

* The rest of the world uses the UN/EDIFACT standard.

* Many EDI software packages support both the standards.

 

Hardware and Software Requirements for

Implementing EDI

* For implementing EDI, you require EDI software and a modem (minimum 28.8k baud, 56k baud recommended).

* You need to convey transactions to and from your trading partners electronically.

* This can be done either using the point-to-point communication method or using a VAN as an intermediary between various trading partners.

* In the point-to-point communication method, you use a telephone line to dial your trading partner’s computer directly.

 

Benefits of EDI

* Reduction in data entry errors

* Elimination of communication lag time between an agency and a customer

* Improved customer service

* Minimized costs of transferring information

* Reduced order time

 

Limitations of EDI

* The limitations of EDI are as follows:

3   Rigid Transaction Set

3   Fixed Business Rules

3   High Costs

3   Slow Pace of Standards Evolution

 

 

Introduction to XML

What is XML

* eXtensible Markup Language (XML) is a text-based markup 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 meaningful tags 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.

 

Introduction to XML

Advantages of XML over EDI

* Some of the advantages of XML over EDI are listed below:

3   Lower Cost

ä  XML does not require a high priced VAN as in the case of EDI.

3   Customized Business Rules

ä  XML enables you to store data in a structured format by allowing you to create customized tags.

 

Advantages of XML over EDI (Contd.)

* Easy to Interpret

3   XML documents can be easily interpreted by the target systems by using a parser.

* Platform Independent

3   As XML documents are platform independent, a business unit can have transactions with any other business unit irrespective of their data storage platform.

 

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 own grammar by specifying the tag set used in the document and the structural relationship that these tags represent.

* SGML was complex and difficult for developers to master.

 

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.

 

Advantages of XML

* The advantages provided by XML are as follows:

3   Domain Specific Vocabulary

3   Data Interchange

3   Smart Searches

3   Granular Updates

3   User-Selected View of Data

 

 

 

Introduction to World Wide Web Consortium

* W3C is responsible for the development of Web specifications (recommendations) that describe communication protocols and the technologies for the Web.

* Role of W3C in defining XML related specifications

3   W3C has laid down certain rules that need to be followed by all XML applications. Listed below are some 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.

 

Introduction to World Wide Web Consortium

(Contd.)

ä  The number of optional features in XML needs to be kept to the absolute minimum, ideally zero.

ä  XML documents must be human-legible and clear.

ä  XML design must be formal and concise.

 

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 their local 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.

 

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. Each product is uniquely identified by a product ID.

 

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.

 

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.

 

 

Task 2: Identify the structure of the document in

which 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 representing information. These components are:

3   Processing Instruction

ä  An XML document usually begins with the XML declaration statement or the Processing Instruction (PI).

ä  The PI provides information regarding the way in which the XML file should be processed.

 

Task 2: Identify the structure… (Contd.)

ä  The PI statement can be written as:

 <?xml version="1.0" encoding="UTF-8" ?>

ä  In the above example, the PI states that version 1.0 is used.

ä  The PI uses the encoding property to specify information about the encoding scheme that is used to create the XML file.

 

Task 2: Identify the structure… (Contd.)

3   Tag

ä  Tags are used to specify a name for a given piece of information.

ä  Tags usually occur in pairs.

ä  Each pair consists of a start tag and an end tag.

ä   The start tag only contains the name of the tag while the end tag includes a forward slash (/) before the name of the tag.

 

Task 2: Identify the structure… (Contd.)

3   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.

 

Task 2: Identify the structure… (Contd.)

3   Content

ä  The information that is represented by the elements of an XML document is referred to as the content of that element.

 

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.

 

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.

 

Task 2: Identify the structure… (Contd.)

3   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 either mandatory or optional.

 

Task 2: Identify the structure… (Contd.) 

3   Attributes   

ä  While deciding whether to represent information as an element or an attribute, you can follow the guidelines given below:

ä  If the data must be displayed, you can represent 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 is better represented as an element because it is easier to edit elements than attributes with XML editing tools.

 

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.

 

Task 2: Identify the structure… (Contd.) 

3   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 reference to an external file that contains textual or binary information.

ä  XML supports the use of three kinds of entities: internal, general, and parameter entities.

 

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.
 

 

Task 2: Identify the structure… (Contd.) 

3   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.

 

Task 2: Identify the structure… (Contd.) 

Result

* Structure of the XML document to be used for storing products data:

 

 

Task 3: Create an XML document to store data.

* Rules for Creating Well-formed XML Documents

3   Every start tag must have an end tag.

3   Empty tags must be closed using a forward slash (/).

3   All attribute values must be given in double quotation marks.

3   Tags must nest correctly.

3   XML tags are case-sensitive. They must match each other in every implementation.

 

 

 

Task 4:View the XML document in a browser.

 

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 various branches 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 price of the book. Each book is uniquely identified by a book ID.

 

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.

 

Summary (Contd.)

* An XML document consists of:

3   Processing Instructions

3   Elements

3   Attributes

3   Entities

3   Comments

3   Content

 

Summary (Contd.)

* The rules that govern the creation of a well-formed XML document are as follows:

3   Every start tag must have an end tag.

3   Empty tags must be closed using a forward slash (/).

3   All attribute values must be given in double quotation marks.

3   Tags must nest correctly.


3   XML tags are case-sensitive. They must match each other in every implementation. 

No comments:

Post a Comment