Professional Documents
Culture Documents
XML Overview2005 MCSD
XML Overview2005 MCSD
XML Overview2005 MCSD
Check
Letter of Prepare Generate P.O. Availability
Credit/Terms Fulfillment Receipt
Send
Arrange Send Receive Prepare Invoice
Shipping Order Order Invoice
Receive Invoice/
Tariffs/ Inspections Post Send Prepare Payment
Customs Payment Check
http://www.commerceone.com/xml/cbl/docs/purchaseorderdtdsamp.html
• Structure
Simple E-mail document
• Content
• Display Receiver: John
Sender: Harry
Subject: Hello
============================
Dear John,
Hello!
………………...
This is the document for you!
Harry
May 12, 1999
Instances /
Domains
RDF CDF CML ...
SGML
© Minder Chen, 1996-2005 XML - 11
So, You Need More Than XML…
DTD Structure r
s e
a r
P
Validation L
X M
Document with
XML Processing
document Special Format
(HTML/CSS)
Content
XSL Display
The markup describes the way in The markup describes the data
which the data is to be displayed itself.
in the browser.
Developers must use a limited set Developers create tags and can
of predefined tags. therefore describe any type of
data.
Searching for and updating data is Searching for and updating data
difficult because the same set of is easy because each type of
tags can be used for different data has a unique set of tags
types of data. that define it.
The way in which data is to be XML does not have any control
displayed in the browser is over the way data is displayed.
controlled.
<PLANT ZONE="3">
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
</PLANT>
Application HTML/CSS
<widget xmlns="http://www.widget.org"
xmlns:xhtml="http://www.w3.org/TR/xhtml1"
type="gadget">
<head size="medium"/>
<big><subwidget ref="gizmo"/></big>
<info>
<xhtml:head>
<xhtml:title>Description of gadget</xhtml:title>
</xhtml:head>
<xhtml:body>
<xhtml:h1>Gadget</xhtml:h1>
A gadget contains a big gizmo
</xhtml:body>
</info>
</widget>
Internal DTD:
<!DOCTYPE rootElement [ elementDeclarations ]>
Attribute
Closing
Opening tag tag
Element
© Minder Chen, 1996-2005 XML - 25
DTD (Document Type Definition)
• DTD defines the valid structure of XML document rules
such as:
flower.dtd
<?xml version="1.0"?>
<!ELEMENT PLANT (COMMON, BOTANICAL)>
<!ATTLIST PLANT ZONE CDATA #IMPLIED>
<!ELEMENT COMMON (#PCDATA)>
<!ELEMENT BOTANICAL (#PCDATA)>
<!DOCTYPE PLANT [
<!ELEMENT PLANT (COMMON, BOTANICAL)>
<!ATTLIST PLANT ZONE CDATA #IMPLIED>
<!ELEMENT COMMON (#PCDATA)>
<!ELEMENT BOTANICAL (#PCDATA)>
]>
<PLANT ZONE="3">
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
</PLANT>
<!DOCTYPE PLANTLIST [
<!ELEMENT PLANTLIST (PLANT+)>
<!ELEMENT PLANT (COMMON, BOTANICAL)>
<!ATTLIST PLANT ZONE CDATA #IMPLIED>
<!ELEMENT COMMON (#PCDATA)>
<!ELEMENT BOTANICAL (#PCDATA)>
]>
<PLANTLIST>
<PLANT ZONE="3">
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
</PLANT>
<PLANT ZONE="2">
<COMMON>Cowslip</COMMON>
<BOTANICAL>Clatha palustris</BOTANICAL>
</PLANT>
</PLANTLIST>
© Minder Chen, 1996-2005 XML - 32
Well-Formed XML and Valid XML
• Well-Formed XML:
– A well-formed XML document does not
necessarily include a DTD or a schema.
• Valid XML:
– XML that conforms to the vocabulary
specified in a DTD or schema.
• Document processing performance:
– Well-formedness is an attribute of all XML documents
– Well-formedness parsing is very fast
– Validation can be time consuming and is specific to a
particular application based on the DTY or Schema
SGML DSSSL
XML XSL
HTML CSS
XSL (Extensible Style Language) defines the specification
for an XML document’s presentation and appearance.
Standard: http://www.w3.org/TR/WD-xsl
XML
Documents
greeting.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<H1> <xsl:value-of /> </H1>
</xsl:template>
</xsl:stylesheet>
XML
XSL (Browser)
Extensible
Stylesheet
Language (Browser-side add-on
or building functions)
© Minder Chen, 1996-2005 XML - 38
XSL
• Transfer well-formed XML documents to
HTML documents
– Mapping
<book_title>Harry Porter</book_title>
<H1>Harry Porter</H1>
– Add some data to user
<book_author>Minder Chen<book_author>
<H2>Author</H2><SPAN>Minder Chen</SPAN>
– Hide some data from user
Document Type
Definition (DTD) Presentation
Application
Authors
Developers
Content
Processing Providers Stylesheets
Applications
XML
Documents
IE 5.0
HTML
XML
JavaScript Code Object Model
XML
Dynamic HTML Parser
Container: (msxml)
• <DIV ID="X"></DIV>
• <SPAN ID="Y"></SPAN> XML
Tags & Data
SERVER CLIENT
Passed over
network as XML
IE5 Browser
XML ASP
Parser File Updates only
ASP file uses XML marshaled into
server-side parser XML by browser
to extract data
Server-side scripting
Servlet or
http://java.sun.com/xml/
© Minder Chen, 1996-2005 XML - 50
simple.xml
<?xml version='1.0'?>
<?xml:stylesheet type="text/xsl" href="simple.xsl" ?>
<breakfast-menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real maple
syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles coverred with strawberrys and whipped cream</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>light Belgian waffles coverred with an assortment of fresh berries and whipped cream</description>
<calories>900</calories>
</food>
<food>
<name>French Toast</name>
<price>$4.50</price>
<description>thick slices made from our homemade sourdough bread</description>
<calories>600</calories>
</food>
<food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
<calories>950</calories>
</food>
</breakfast-menu>
XML XML
Database Converter XML Parser
Client
Application
Use Server-side
scripting & Server-
Side XML Parser
http://www.oasis-open.org/cover/xml.html#applications
© Minder Chen, 1996-2005 XML - 55
Commerce Scenarios
Consumer
1
Suppliers
1 3
Corporation
Distributors MRO
and 2
retailers
Suppliers
Business
4 Value chain
customers 2
Business to consumer
(Business to business)
Selling to businesses
Corporate purchasing (MRO)
Extended value chain
© Minder Chen, 1996-2005 XML - 56
B2C Data Exchange: Existing Methods - HTML Forms
XML XML