cis 451: introduction to xml dr. ralph d. westfall october, 2011

17
CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Upload: allison-freeman

Post on 30-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

CIS 451: Introduction to XML

Dr. Ralph D. WestfallOctober, 2011

Page 2: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

ML = Mark Up example: hand written comments

by grader in an English composition class spelling and grammar corrections delete material add words move material to another location put words in italics

Page 3: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

XML Is a Markup Language markup languages tell how to format text proprietary markup languages

word processors e.g. Word, WordPerfect binary (can't use in different systems

[PC won't work in Mac] [download example])

open markup languages (public domain) SGML, rich text (rtf), HTML

text-based (works with any system) in Word, can save as rich text, then open in

Notepad (example)

Page 4: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Markup Language Features stylistic (appearance) e.g.

<i><b><u> structural (layout) e.g. <p><br><h2> semantic (meaning/description) e.g.

<title><meta name=keywords content = " …... " >

functional (interactive) e.g. <a href = "[link]">click here</a> <input type = "submit" />

Page 5: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Markup Language Components Example: <b>Hello</b>

<b> = start tag </b> = end tag Hello = content (or data) < > = delimiter characters (identify

tags) <b>Hello</b> = element

element = tags + content

Page 6: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

ML Components - 2 Attributes - Example:

<img src="tbird.jpg" align="right" alt = "57 T-Bird">

name/value pairs identify attributes (source, alignment, alternate text), and give values for each

Page 7: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

SGML: Mother of All MLs can be used for publishing almost anything

mathematics, chemistry, patent office, electronics industry, aerospace industry, UNIX documentation, dictionaries

very complex, very hard to use use is limited (specialized applications) and

new applications are generally in XML can be used to write other markup

languages such as XML

Page 8: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

HTML Derived From SGML is an "application" of, defined in

SGML adapted to Internet simplified - fewer features much easier to learn and use

aspects inherited from SGML open text, not binary (cross-platform)

Page 9: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Limitations of HTML limited number of tags

not extensible, so users can't add tags very little meaning (other than <title>

and <meta> tags) it is "flat" – it can't identify element

relationships such as (like class variables): name = first name + last name customer = name + address (street +

city + etc.)

Page 10: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

HTML Limitation Implications sometimes can't do what want to do

limited number of tags difficult to use content for applications

computers can't "understand" content leads to higher network traffic volumes

on Internet, intranets send whole page when only part is needed

Page 11: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

XML Is Better better than SGML

80% of capabilities, 20% of complexity Pareto's principle small enough to be supported by browser

vendors explicitly includes hyperlinking supports style sheets

better than HTML extensible (can create your own tags) tags identify content e.g. item and its price

Page 12: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Other XML Advantages "XML is about data" (not locked into

format) e.g. <ol> formats as a numbered list, but

might want a different format e.g. table slsrcpt.xml, slsrcpt.html, slsrcpt2.html

(View>Source on HTML files) much better searching

can search for meaning, not just content computer (name/model) price < $700

data interchange e.g. "legacy applications"

Page 13: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Design Goals for XML easy to use through the Internet support a wide variety of applications compatible with SGML easy to write programs that access XML avoid optional features (compatibility) XML should be readable by humans

Page 14: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Design Goals for XML - 2 XML specifications formal and

concise XML documents easy to create clarity more important than brevity

from Pardi, 1999

Page 15: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Creating XML Documents very similar to writing HTML,

except you make up your own tags <?xml version="1.0"?><!--required--> <books><!--root element--> <textbooks> <title>Beginning ASP.NET</title> <!--other items--> </textbooks> </books>

Page 16: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

An XML "Hierarchy" (Outline) textbooks (root element)

book (repeating element) title ISBN authors

author_name (repeating element) description price

Page 17: CIS 451: Introduction to XML Dr. Ralph D. Westfall October, 2011

Exercise get a business form (Business Nation)

Pre-Employment Checklist Form create an XML file

can use pattern on slide 19 make sure all start tags have end tags

save with .xml extension view in Internet Explorer save file for use again (next lectures)