XML Introduction-E Commerce-Lecture Slides, Slides of Fundamentals of E-Commerce

This is lecture for E-Commerce course. It was delivered by Prof. Abhra Honnenahalli at Acharya Nagarjuna University. It inlcudes: XML, Introduction, Extensible, Markup, Language, Generalized, HTML, Database, Document, Tag, Structure, Data

Typology: Slides

2011/2012

Uploaded on 08/08/2012

shazli_1991
shazli_1991 🇮🇳

4.4

(11)

101 documents

1 / 55

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Introduction
XML: Extensible Markup Language
Defined by the WWW Consortium (W3C)
Originally intended as a document markup language not a
database language
Documents have tags giving extra information about sections of the
document
E.g. <title> XML </title> <slide> Introduction …</slide>
Derived from SGML (Standard Generalized Markup Language), but
simpler to use than SGML
Extensible, unlike HTML
Users can add new tags, and separately specify how the tag should
be handled for display
Goal was (is?) to replace HTML as the language for publishing
documents on the Web
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37

Partial preview of the text

Download XML Introduction-E Commerce-Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Introduction

XML: Extensible Markup Language

Defined by the WWW Consortium (W3C)

Originally intended as a document markup language not adatabase language

Documents have tags giving extra information about sections of thedocument

E.g. XML Introduction …

Derived from SGML (Standard Generalized Markup Language), butsimpler to use than SGML

Extensible

, unlike HTML

Users can add new tags, and

separately

specify how the tag should

be handled for display

Goal was (is?) to replace HTML as the language for publishingdocuments on the Web

XML Introduction (Cont.)

The ability to specify new tags, and to create nested tag structuresmade XML a great way to exchange

data

, not just documents.

Much of the use of XML has been in data exchange applications, not as areplacement for HTML

Tags make data (relatively) self-documenting

E.g.

A-

Downtown

500

A-

Johnson

XML Motivation (Cont.)

Earlier generation formats were based on plain text with lineheaders indicating the meaning of fields

Similar in concept to email headers

Does not allow for nested structures, no standard “type” language

Tied too closely to low level document structure (lines, spaces, etc)

Each XML based standard defines what are valid elements, using

XML type specification languages to specify the syntax^ 

DTD (Document Type Descriptors) 

XML Schema

Plus textual descriptions of the semantics

XML allows new tags to be defined as required

However, this may be constrained by DTDs

A wide variety of tools is available for parsing, browsing andquerying XML documents/data

Structure of XML Data

Tag

: label for a section of data

Element

: section of data beginning with <

tagname

> and ending

with matching … ….

Improper nesting

… ….

Formally: every start tag must have a unique matching end tag, thatis in the context of the same parent element.

Every document must have a single top-level element

Motivation for Nesting

Nesting of data is useful in data transfer

Example: elements representing customer-id, customer name, andaddress nested within an order element

Nesting is not supported, or discouraged, in relational databases

With multiple orders, customer name and address are storedredundantly

normalization replaces nested structures in each order by foreign keyinto table storing customer name and address information

Nesting is supported in object-relational databases

But nesting is appropriate when transferring data

External application does not have direct access to data referencedby a foreign key

Structure of XML Data (Cont.)

Mixture of text with sub-elements is legal in XML.

Example:

This account is seldom used any more. A-102 Perryridge400

Useful for document markup, but discouraged for datarepresentation

Attributes Vs. Subelements

Distinction between subelement and attribute

In the context of documents, attributes are part of markup, whilesubelement contents are part of the basic document contents

In the context of data representation, the difference is unclear andmay be confusing

Same information can be represented in two ways

  • …. –

A-101 …

Suggestion: use attributes for identifiers of elements, and usesubelements for contents

More on XML Syntax

Elements without subelements or text content can be abbreviatedby ending the start tag with a /> and deleting the end tag

To store string data that may contain tags, without the tags beinginterpreted as subelements, use CDATA as below

Here, and are treated as just strings

XML Document Schema

Database schemas constrain what information can be stored,and the data types of stored values

XML documents are not required to have an associated schema

However, schemas are very important for XML data exchange

Otherwise, a site cannot automatically interpret data received fromanother site

Two mechanisms for specifying XML schema

Document Type Definition (DTD)

Widely used

XML Schema

Newer, increasing use

Document Type Definition (DTD)

The type of an XML document can be specified using a DTD

DTD constraints structure of XML data

What elements can occur

What attributes can/must an element have

What subelements can/must occur inside each element, and howmany times.

DTD does not constrain data types

All values represented as strings in XML

DTD syntax

Bank DTD

]>

Attribute Specification in DTD

Attribute specification : for each attribute

Name

Type of attribute

CDATA

ID (identifier) or IDREF (ID reference) or IDREFS (multiple IDREFs)

more on this later

Whether

mandatory (#REQUIRED) 

has a default value (value), 

or neither (#IMPLIED)

Examples

ATTLIST customer

customer-id

ID

# REQUIRED

accounts

IDREFS # REQUIRED

Bank DTD with Attributes

Bank DTD with ID and IDREF attribute types.

… declarations for branch, balance, customer-name,

customer-street and customer-city

]>

XML data with ID and IDREF attributes

Downtown

500

Joe

Monroe

Madison

Mary

Erin

Newark