supply chain & enterprise systems extensible markup language (xml) basics mis 6483 – spring...

26
Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 www.suse1.astate.edu/~jseydel Guest Instructor: John Seydel, Ph.D.

Upload: garry-archibald-fitzgerald

Post on 11-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Supply Chain & Enterprise Systems

eXtensible Markup Language (XML) Basics

MIS 6483 – Spring 2009www.suse1.astate.edu/~jseydel

Guest Instructor: John Seydel, Ph.D.

Page 2: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Student Objectives

Upon completion of this material you should be able to Describe the basics of what a markup language is

and how it works Discuss where XML fits as a markup language Identify opportunities to use XML as a data

wrapper Create XML files to be used in web applications Summarize several common uses of XML Discuss what a DTD does Identify several applications that currently use XML

Page 3: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Let’s Start with an Overview of Computer Languages Programming languages

Standalone Traditional (e.g., COBOL) Object-oriented (e.g., Java, VB.NET)

And/or scripting languages (rely on other components) JavaScript Others (e.g., PHP)

Markup languages (e.g., SGML, HTML, XHTML, DHTML)

Stylesheet languages (e.g., CSS, XSL) Database languages (e.g., SQL) How about XML . . . ?

Page 4: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Markup Languages: A High Level Perspective

HTM L

XHTM L M athM L GuestM L . . .

XM L Others

SGM L

Page 5: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Some Markup Basics: Sample HTML for a Starter Web Page<html>

<head><title>Home Page for Suzy Student</title>

</head><body>

<h1>Suzy Student</h1><h2>Welcome to My Website!</h2><p>

This site is currently under construction, so

please come back later.</p>

</body></html>

Page 6: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Summary of the Basic HTML Page Document contains

Title Page header Second level heading Short paragraph

Markup elements: html head body title h1 h2 p

Note the hierarchy

Refer to another example (see handout) . . .

Page 7: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

eXtensible Markup Language XML facilitates the interchange of information

across disparate applications Not a markup language in itself; instead XML is a

meta language XML can be used to create customized markup

Generally not for web pages; exceptions Ajax (note the “X”) RSS feeds

Instead for applications; consider the file format used for Office 2007 documents Compressed XML files Surprisingly smaller than binary files

Note that XHTML is essentially just HTML reformulated to conform to XML specifications

XML requires more than HTML, in particular a processing application

Page 8: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Exercise: Look at Some XML Examples First, login locally as peachtree (password is

accounting2008) Microsoft PowerPoint 2007

Open PowerPoint Create a three slide presentation and save

someplace you’ll be able to find it Close PowerPoint and navigate to the file Is this XML?

Now, navigate to ASU’s home page Select “NEWS & EVENTS” Click on RSS View the source code

If possible, use RDC to look at SimNet data

Page 9: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

XML Components A processing application

Parses the code and then does something with it Checks for well-formed documents May also validate

Includes one or more of the following Desktop application Web browser Other . . . ?

Code XML document DTD Stylesheet

CSS (preferred for the time being) XSL (not well supported yet)

Page 10: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Why a DTD? With XML, we can

Create our own markup language Use someone else’s markup

Thus, a DTD (i.e., DOCTYPE) can be used to ensure completeness and consistency Tells the user agent what the tags mean Provides syntax for the tags

Note: XML documents resemble HTML documents, but the tags are different The DTD for HTML is built into browsers User agents need to look externally for DTDs

for XML documents More later (if time permits)

Page 11: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Why Use XML? Makes data free of context Can do much more with it Not restricted to standard browsers Can render/process same set of data

numerous ways, depending upon the DTD employed

Allows for special purpose treatment of content (e.g., chemical formulae, house plans, etc.)

Hence Application integration through marked up

data Greater overall flexibility

Page 12: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

A Sample XML Document

Language: RML (Recipe Markup Language)

Note XML declaration DTD for <recipe> element Content

How would this look?

Page 13: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Sample RML Document<?xml version=“1.0” encoding=“UTF-8”?><!DOCTYPE recipe SYSTEM “rml.dtd”><recipe cook=“JoJo Beans”>

<title>Bean Burrito</title><category name=“tex-mex” /><ingredients> <item>1 can refried beans </item> <item>1 small onion </item> <item> 3 flour tortillas</item></ingredients><cooking> Empty beans into saucepan and heat until beans are smooth. Then warm tortillas in microwave oven for 30 seconds.</cooking><serving>

Spread 1/3 of beans on each tortilla, sprinkle with onions, roll, and

serve.</serving>

</recipe>

Page 14: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Notice Some Things

General guidelines: XML declaration and DTD One tag contains all the others (root) All elements (including empty elements) have

start/end Elements are nested (e.g., item within

ingredient) Hierarchical Parent/child relationships

Attribute values quoted In other words, the same rules we should

be applying to HTML (i.e., XHTML) Consider another XML document . . .

Page 15: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Look Familiar?<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE

html PUBLIC "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“

><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head><title>Home Page for Suzy Student</title></head><body background="images/torch.gif">

<h1> <a href="http://www.astate.edu"> <img border="0" src="images/asu.gif" /> </a> Suzy Jo Student </h1> <h3><em>Welcome to my web site; Here's what you'll

find:</em></h3> . . .

</body></html>

Page 16: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

An XML Exercise

Web application (Ajax) Involves

Local files to be editted; save in c:\xampp\htdocs HTML file (get from website) XML file (create in NotePad)

Remote files JavaScript CSS Images

Working version: www.suse1.astate.edu/~jseydel/handouts/xml_html.php

Page 17: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Now, the DTD

Can be within the XML document More often external Where can we find one to look at? How about ANY web page . . . ? Defines: elements, content,

attributes, parent/child, entities

Page 18: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

DTDs Specify Element Declarations

General syntax <!ELEMENT name EMPTY> <!ELEMENT name #PCDATA> <!ELEMENT name child1,child2, . . . > <!ELEMENT name #PCDATA | child>

Consider XHTML elements img p ul div

Page 19: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Finally, Attribute Lists

General syntax<!ATTLIST attr1 attr2 CDATA #REQUIRED><!ATTLIST attr1 attr2 CDATA IMPLIED>

XHTML attributes (for <img> tag) src alt width height onMouseOver . . .

Page 20: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Summary of Objectives

Describe the basics of what a markup language is and how it works

Discuss where XML fits as a markup language Identify opportunities to use XML as a data

wrapper Create XML files to be used in web applications Summarize several common uses of XML Discuss what a DTD does Identify several applications that currently use

XML

Page 21: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Appendix

Page 22: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Facilitating B2B eCommerce

Page 23: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

XML File for Ajax Example<?xml version="1.0" ?><root>

<data><row>

<cell>Name</cell><cell>Fruit</cell><cell>Vegetable</cell>

</row><row>

<cell>Captain</cell><cell>Banana</cell><cell>Zucchini</cell>

</row><row>

<cell>Admiral</cell><cell>Melon</cell><cell>Carrot</cell>

</row><row>

<cell>Midshipman</cell><cell>Orange</cell><cell>Potatoe</cell>

</row></data>

</root>

Page 24: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

File Formats Supported by the Web

Page 25: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

Basic Architecture of the Web

Page 26: Supply Chain & Enterprise Systems eXtensible Markup Language (XML) Basics MIS 6483 – Spring 2009 jseydel Guest Instructor: John

More Sophisticated Web Architecture