190 likes | 347 Views
XML Demystified. 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
E N D
XML Demystified 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
What The!? • Extensible Markup Language • A nested tree structure of elements • Allows users to define their own elements • Designed for carrying data
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, …
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
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
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
Example… Root Element Attribute Value
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
XPath • A method of traversing an XML document • Useful for retrieving attributes and values of tags
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)
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
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
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
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