XML D EMYSTIFIED Presented By Carl-Erik Svensson.

19
XML DEMYSTIFIED Presented By Carl-Erik Svensson

Transcript of XML D EMYSTIFIED Presented By Carl-Erik Svensson.

Page 1: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

XML DEMYSTIFIEDPresented By Carl-Erik Svensson

Page 2: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

Announcements

Assignment 1.2 is due Wednesday 2/11/09 at 8am Name your SVN check-in mp1.2 csil-projects.cs.uiuc.edu/svn/sp09/cs242/netid/

mp1.2 Make sure you are attending discussion Make sure you are using SVN Assignment 1.3 is due Wednesday 2/18/09 at

8am My office hours on 2/16/09 will be cancelled

Page 3: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

WHAT THE!?

Extensible Markup Language A nested tree structure of elements

Allows users to define their own elements Designed for carrying data

Page 4: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

SIGNIFICANCE

Creates an open standard for sharing data Simple, and easy to read both by people and

machines Foundation for many Internet languages Separates content from presentation Widely adopted

Microsoft, IBM, Sun, SAP, Mozilla, …

Page 5: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

ARE YOU FOR SERIOUS?

Here’s a list of technologies/products that use XML Open XML (ala .docx files and Office 2007) Google Earth (KML) Finale Notepad (MusicXML) Scalar Vector Graphics (SVG) The Internet (HTML) Really Simple Syndication Feeds (RSS) Apache ANT

Page 6: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

A BRIEF HISTORY

Evolved from SGML (1986), inspired by Charles Goldfarb (and co.) at IBM in 1970

Resulted in HTML Standards were loosened Data and display became intertwined (bad!)

Adopted by Microsoft, Sun, and IBM Useful for interoperability Owned by W3C

Page 7: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

STRUCTURE

XML has a tree structure Contains a root element

Beneath the root are additional elements Each element can have various attributes

It is implemented with tags <aTag> contains text or other tags Every opening <tag> must contain a closing

</tag> Tags can have any name

Page 8: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

EXAMPLE

Page 9: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

EXAMPLE…

Root Element

Attribute

Value

Page 10: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

VALIDATION

We want to share our data with the world The world needs to know what our data looks like We can define our data with a schema

XML Data can then be validated automatically XSD DTD

Page 11: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

XPATH

A method of traversing an XML document Useful for retrieving attributes and values of

tags

Page 12: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

DTD

Page 13: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

DISPLAY

We have data, now what? This data can be parsed by any number of

programs Data generated by web scraping Kernel files consumed by image convolution DEM to BMP converters/manipulators

We can also display the data directly CSS XSL(T)

Page 14: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

CSS

Page 15: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

XSLT

A method of defining a transformation from XML to something else Usually HTML

Contains complex structure Can define rules for each tag Typically these rules describe how to render a

tag Utilizes XPath expressions

Page 16: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

Assignment 1.3

Use an XML file to define operations This will require parsing an XML file Luckily, there are some parsers we can use

Call operations defined in the XML file Now we can define any combinations of basic

operations as a single operation This makes our application externally

programmable Due Wednesday, Feb 18th at 8am in SVN

Page 17: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

Assignment 1.3 - Sample XML Root is Operations Operations contains

multiple ComplexOps Each ComplexOp is

named and contains multiple Ops

Each Op is named and contains parameters

Page 18: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

Assignment 1.3 - DTD

Page 19: XML D EMYSTIFIED Presented By Carl-Erik Svensson.

RESOURCES

http://www.w3schools.com/xml/default.asp http://www.itwriting.com/xmlintro.php http://www.w3schools.com/xpath/default.asp http://www.w3schools.com/DTD/ http://www.grinninglizard.com/tinyxml/ http://ezxml.sourceforge.net/ http://agora.cs.illinois.edu/display/cs242sp09/

Assignment+1.3