26
eXtensible Markup Lang uage (XML) IEEM 5352 E-Enterprise Integration

IEEM 5352 E-Enterprise Integration

  • Upload
    trish

  • View
    50

  • Download
    5

Embed Size (px)

DESCRIPTION

IEEM 5352 E-Enterprise Integration. eXtensible Markup Language (XML). What is XML?. XML: eXtensible Markup Language (XML) defines an universal standard for electronically exchanging data for the Internet and Web applications and is supported by major IT vendors. Topics covered include: - PowerPoint PPT Presentation

Citation preview

Page 1: IEEM 5352 E-Enterprise Integration

eXtensible Markup Language (XML)

IEEM 5352 E-Enterprise Integration

Page 2: IEEM 5352 E-Enterprise Integration

What is XML?• XML: eXtensible Markup Language (XML) defines an univer

sal standard for electronically exchanging data for the Internet and Web applications and is supported by major IT vendors. Topics covered include:

– Authoring XML element and documents

– XML schema and Document Type Definition (DTD)

– XSL (eXtensible Style Language) for transforming XML to HTML

– Tools for authoring and browsing XML to document

• XML 是在網際網路及 Web 上定義資料標準格式之語言。 XML 是將傳統的 SGML 加以簡化 , 但是又比 HTML 有彈性 , 使用者可自行定義標籤 (Tags), 用來傳輸有結構性的資料是 HTML 之後方興未艾的 Web 標準。在電子商務上 ,尤其企業間 (B2B) 電子商務交易 ,XML 將式資料交換企業整合的重要技術與標準。

Page 3: IEEM 5352 E-Enterprise Integration

• XML can take large chunks of information and consolidate them into an XML document - meaningful pieces that provide structure and organization to the information.

Page 4: IEEM 5352 E-Enterprise Integration

Basic building block of an XML document is the element defined by tags.

Page 5: IEEM 5352 E-Enterprise Integration

Root element -> Nested elements -> Hierarchical structure.

Page 6: IEEM 5352 E-Enterprise Integration

XML Documents• An well formed XML document can be read and understood by a

n XML parser.

• DTD (Document Type Definition) determines the structure and elements of an XML document.

• XML parsers read XML documents and xtract the data for access by another program.

Page 7: IEEM 5352 E-Enterprise Integration

EXL-Enabled Standards

• RosettaNet is a consortium of product vendors and end users that defines a framework for data and process interchange with e-business -XML document and standard process flows.

• XEDI is published specification describing how to map traditional EDI to XML and back again.

• BizTalk is an industry consortium founded by Microsoft to define a standard XML grammar for XML-based messaging and metadata.

Page 8: IEEM 5352 E-Enterprise Integration

EXL-Enabled Standards (cont.)

• XFRML is an XML standard for reporting financial information over the Internet.

• XML-Schema is a working group of the W3C that is looking to describe a better mechanism for determining the structure of an XML document.

• XML Query is another W3C working group looking to create a common set of operations and language syntax for accessing persisted XML data.

• XSLT provides a standard XML document transformation mechanism using a stylesheet as a common processing engine.

Page 9: IEEM 5352 E-Enterprise Integration

XML Tools

• XML Notepad (XML Editing Tool) – http://msdn.microsoft.com (.NET Frameworks 2.0)

– http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628&displaylang=en (XML Notepad)

• XML Parser– Edit/Create Cascading Style Sheet (CSS)

– http://www.microsoft.com/downloads/thankyou.aspx?familyId=2cf40ae6-368c-4b6b-a185-2dfa92fb7993&displayLang=en (Microsoft XML Parser)

Page 10: IEEM 5352 E-Enterprise Integration

XML Example File (prods.xml)<?xml version=“1.0”?>

<PRODUCTLIST xmlns=“x-schems:listschema.xml”>

<PRODUCT>

<ID>722</ID>

<NAME>PENTIUM 100</NAME>

<PRICE>1000</PRICE></PRODUCT>

<PRODUCT>

<ID>721</ID>

<NAME>PENTIUM 11 300<NAME>

<PRICE>5000</PRICE></PRODUCT>

<PRODUCT>

<ID>720</ID>

<NAME>PENTIUM 111 450</NAME>

<PRICE>15000</PRICE> </PRODUCT>

</PRODUCTLIST>

Page 11: IEEM 5352 E-Enterprise Integration

Rules for Well-Formed XML

• Mandatory Closing Tag– The set of tags are unlimited but all container

tags must have end tag, e.g., <tag>…</tag>.

• Example:• <number>kj9876_34</number>

• <due>1/12/98</due>

• <bill_to>MTB1</bill_to>

• <ship_to>MTO1</ship_to>

• <selling_party>AC987</selling_party>

Page 12: IEEM 5352 E-Enterprise Integration

Rules for Well-Formed XML (cont.)

• Proper Element Nesting– All tags must be nested correctly. Like HTML,

XML can intermix tag, but tags may not overlap each other.

• Legal XML <PRODUCT>

<ID>721</ID>

<NAME>PENTIUM 11 300</NAME>

<PRICE>5000</PRICE>

</PRODUCT>

Illegal XML<PRODUCT>

<ID>

<NAME>PENTIUM 11 300<NAME>

<PRICE>5000</PRICE>

</PRODUCT>

</ID>

Page 13: IEEM 5352 E-Enterprise Integration

Rules for Well-Formed XML (cont. 2)

• Double-quote value delimiters– All attribute values must be enclosed in single

or double quotation marks.

• Legal:– <tag attribute=“value”>

• Illegal:– <font size = 6>

<XML>

<xml>

are different

Page 14: IEEM 5352 E-Enterprise Integration

Rules for Well-Formed XML (cont. 3)

• Single tag element– Singleton tag (called empty element or tags without

content) must be written in an abbreviated form using special XML syntax.

• Legal:– <BR/>

• <TITLE></TITLE> is equivalent to <TITLE/>

Page 15: IEEM 5352 E-Enterprise Integration

XML with an internal DTD<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE BASEBALL SYSTEM "Baseball.dtd">

<BASEBALL>

<TEAM>

<CITY>New York</CITY>

<PLAYER>

<LASTNAME>Strawberry</LASTNAME>

<FIRSTNAME>Daryl</FIRSTNAME>

<AVG>.286</AVG>

</PLAYER>

</TEAM>

<TEAM>

<CITY>Baltimore</CITY>

<PLAYER>

<LASTNAME>Alomar</LASTNAME>

<FIRSTNAME>Roberto</FIRSTNAME>

<AVG>.287</AVG>

</PLAYER>

</TEAM>

</BASEBALL>

DTD (Baseball.dtd)<!ELEMENT BASEBALL (TEAM)+><!ELEMENT TEAM (CITY, PLAYER*)><!ELEMENT CITY (#PCDATA)><!ELEMENT PLAYER (LASTNAME, FIRSTNAME, AVG)><!ELEMENT FIRSTNAME (#PCDATA)><!ELEMENT LASTNAME (#PCDATA)><!ELEMENT AVG (#PCDATA)>

+: 1 or more*: 0, 1 or more

Page 16: IEEM 5352 E-Enterprise Integration

XML Runtime System Architecture

document CommunicationFramework

Converters

Protocols

XMLParser

XMLParser

XML/JavaEvents

XML/JavaEvents

publishDocument

Router

Document Services

Document Services

Document Services

Document Services

publishsubscribe

Document ServiceFramework

Document ServiceFramework

Page 17: IEEM 5352 E-Enterprise Integration

DTD/

XML Schema

XML

document

content

Structure

Document with

Special Format

(HTML/CSS)

XSL Display

Processing for Display or Conversion

XML 之網頁呈現

XML Parser

Page 18: IEEM 5352 E-Enterprise Integration

XML Parser

DatabaseXMLConverter

XMLXMLPARSER

Client Application

Client

Application

SERVER CLIENTNETWORKNETWORK

Page 19: IEEM 5352 E-Enterprise Integration

XML SCHEMA

• XML SCHEMA (XML-DATA)– Much richer and more extensible way– Describe the rule for the content of a document

and use XML itself as a grammar– It was submitted to the W3C as the XML-

DATA submission

Page 20: IEEM 5352 E-Enterprise Integration

• A schema is defined using a particular XML syntax

• <ElementType name="to" content="textOnly" />

• <ElementType name="from" content="textOnly" />

• <ElementType name="cc" content="textOnly" />

• <ElementType name="bcc" content="mixed">

• <attribute type="hidden" required="yes" />

• </ElementType>

• <element type="to" minOccurs="1" maxOccurs="*" />

• <element type="from" minOccurs="1" maxOccurs="1" />

• <element type="cc" minOccurs="0" maxOccurs="*" />

• <element type="bcc" minOccurs="0" maxOccurs="*" />

XML SCHEMA

Multiple

Page 21: IEEM 5352 E-Enterprise Integration

XML

Web

Server

eXtensible

Stylesheet

Language (XSL)

XML

XSL

HTML

(Browser)

XML and XSL

Internet

Page 22: IEEM 5352 E-Enterprise Integration

XSL Example File

<?xml version=“1.0”?><HTML xmlns:xsl=“http:www.w3.org/tr/wd-xsl”><body><h1>test</h1><xsl:for-each select=“PRODUUCTLIST/PRODUCT”><DIV STYLE=“background-color:teal;color:white;padding:4px”><SPAN STYLE=“font-weight:bold;color:white”><xsl:value-of select=“id”/></SPAN><xsl:value-of select=“name”/></DIV><DIV STYLE=“margin-left:20px;margin-bottom:font-size:12pt”><I>price:<xsl:value-of select=“price”/></I></DIV><xsl:for-each></body></HTML>

Page 23: IEEM 5352 E-Enterprise Integration

Business to Customer

Bookstore

Customer

Search

Web

Server

Bookstore

Database

publisher Publisher

Order

books

Order this book

Index all book

Book List Publish

XML

Page 24: IEEM 5352 E-Enterprise Integration

References• Http://www.w3.org• Extensible Markup Language (XML) 1.1 (Second E

dition)– http://www.w3.org/TR/2006/REC-xml11-20060816

• Extensible Stylesheet Language (XSL) Version 1.1 – http://www.w3.org/TR/2006/REC-xsl11-20061205/

• XSL Transformation (XSLT)– http://www.w3.org/TR/2007/REC-xslt20-20070123/

Page 25: IEEM 5352 E-Enterprise Integration
Page 26: IEEM 5352 E-Enterprise Integration

XML Notepad