31
XML XML A brief A brief introduction introduction ---by Yongzhu Li

XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

  • View
    223

  • Download
    1

Embed Size (px)

Citation preview

Page 1: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XMLXMLA brief introductionA brief introduction

---by Yongzhu Li

Page 2: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 2CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XMLeXtensible Markup Language

designed to describe data.

a family of technologies

platform-independent

free and extensible

Page 3: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 3CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Basic Concepta markup language is a mechanism to identify structures in a document.

the XML specification defines a standard way to add markup to documents.

a meta-language for describing markup languages

provides a facility to define tags and the structural relationships between them

Page 4: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 4CSI668Topics in System Architecture

SUNY Albany Computer Science Department

BackgroundSGML Standard Generalized Markup Language (ISO

8879) provides arbitrary structure, but too difficult to

implement just for a web browser.

HTML A subset of SGML with a fixed tag semantics

and set, lack of flexibility and extensibility Lack of extensibility

Page 5: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 5CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Background IIXML simplified SGML, extensible looks like HTML but isn't HTML any fully conformant SGML system will

be able to process XML documents but, XML documents does not require a

system that is capable of the full conformance of SGML

Page 6: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 6CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Evolving HistoryW3 Consortium began work in Aug. 1996

XML 1.0 Released by W3C on Jan. 10, 1998

XML 2.0 Introduced on Oct. 6, 2000

XML 3.0 Under drafting and evaluating

Page 7: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 7CSI668Topics in System Architecture

SUNY Albany Computer Science Department

What XML looks likeprolog --- XML file declaration <?xml version=“1.0”?>

comment <!-- any comments -->

processing instruction, PI <?xml-stylesheet type="text/css"

href="first.css"?>

element and its attribute <price currency ="$">15.50</price>

Page 8: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 8CSI668Topics in System Architecture

SUNY Albany Computer Science Department

First Sample

single XML file only provide structured data

No formatting information

browser don’t know how to display

a single XML document

Page 9: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 9CSI668Topics in System Architecture

SUNY Albany Computer Science Department

CSSCascading Style Sheets

also work well with HTML

delaring CSS within XML file <?xml-stylesheet type="text/css"

href="first.css"?>

separate data content with its form

only provide formatting information, lack of manipulation on data

Page 10: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 10CSI668Topics in System Architecture

SUNY Albany Computer Science Department

First Sample IIFormated Source CSS file

Page 11: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 11CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Interesting CSSCascading layers z-index position

sampleXMLCSS

Page 12: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 12CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Interesting CSS IIFilter filter:glow(color=blue, Strength=5);

sampleXMLCSS

Page 13: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 13CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XSLeXtensible Stylesheet Languagedeclaring XSL within XML

<?xml-stylesheet type="text/xsl" href="first.xsl"?>

transform XML to HTML filedefining and formating XML parts and patternsfar more sophisticated but powerful than CSS

Page 14: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 14CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XSL by SampleData Sorting XSL Source

Data Filter XSL Source

Page 15: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 15CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Namespace

a collection of element type and attribute names

distinguish between duplicate element type and attribute names

Page 16: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 16CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Namespace Samples<books xmlns:book=“books.dtd” xmlns:journal =“journal.dtd”> <book:title>

….. </book:title> <journal:title>

….. </journal:title>

Page 17: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 17CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Name Space Sample II<html xmlns:html=“http://www.w3.org/TR/REC-html40”>

<html:h1>some message</html:h1>

<html:a href= mailto:[email protected]> email me</html:a>

Page 18: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 18CSI668Topics in System Architecture

SUNY Albany Computer Science Department

DTDDocuments Type Definitiona model for describing the structure of information. Well formed XML and Valid XMLA valid XML must follow a specific DTD

Page 19: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 19CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Why DTDIndependent organizations use a common DTD for interchanging data. applications use DTD to verify the data received from the outside world is valid.

Page 20: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 20CSI668Topics in System Architecture

SUNY Albany Computer Science Department

DTD IIDeclaring DTD within XML <!DOCTYPE books SYSTEM “book.dtd”>

Element Declaration within DTD <!Element title (#PCDATA)> <!Element book (title,author+, press,

price)> <!Element books (book*)>

Attribute Declaration <!ATTLIST price currency ($|€|¥)’$’>

Eric:

Parsable Character Data

Eric:

Parsable Character Data

Page 21: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 21CSI668Topics in System Architecture

SUNY Albany Computer Science Department

DTD Weaknesswritten in a different (non-XML) syntax.

don’t support namespace

only offer extremely limited data types.

have a complex and fragile extension mechanism

Page 22: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 22CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Schemareplacement of DTDs for XML

more primitive data types

namespace support.

itself is a well formed XML and validated by Schema DTDs

Page 23: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 23CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XML Application Domain

Electronic Data Interchange

search engine

web application

distributed documentation and computing

Page 24: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 24CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Some other XML applications

WML, Wireless Markup Language

CML, Chemistry Markup Language and MathML

OSD, Open Software Description

OFX, Open Financial Exchange

Page 25: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 25CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XML Application Structure

Viewer #1

e.g. Retail Agent Viewer #2

e.g. Customer

XML Processor

Application Server

DB 1 DB 2 DB .. DB nMay be heterogeneous DBs

Other process

CSS/ XSL translation

CSS/ XSL translation

Page 26: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 26CSI668Topics in System Architecture

SUNY Albany Computer Science Department

DOMDocument Object Model

program interface for XML

represents a tree view of the XML

documentElement as a root

childNode for other branch

each node is an object Node Interface Model

Page 27: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 27CSI668Topics in System Architecture

SUNY Albany Computer Science Department

SAXthe Simple API for XMLanother programming interface for XMLevent-based APIuse call-back functions to handle parsing eventSAX and DOM are two major APIs for XML application development.

Page 28: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 28CSI668Topics in System Architecture

SUNY Albany Computer Science Department

SVGScalable Vector Graphic

XML application

describe two-dimensional vector graphic shapes, images and text

reduced the network traffic

reduced server overload

VML by Microsoft and PGML by Adobe

Page 29: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 29CSI668Topics in System Architecture

SUNY Albany Computer Science Department

XHTMLeXtensible HTML

HTML defined by XML

well-formed HTML

tag names must be in lowercase

Page 30: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

XML

--- a brief introduction 30CSI668Topics in System Architecture

SUNY Albany Computer Science Department

Things under going…Xlink and Xpointer allows elements to be inserted into XML in order to

create and describe links between resources provide multi-directional hypertext and hypermedia

support proposal recommendation on Dec. 20, 2000

XML Protocol to develop technologies which allow two or more

peers to communicate in a distributed environment, using XML as its encapsulation language.

requirement draft on Dec. 19, 2000

Page 31: XML A brief introduction ---by Yongzhu Li. XML --- a brief introduction 2 CSI668 Topics in System Architecture SUNY Albany Computer Science Department

Thank YouThank You

谢谢谢谢