XML: What, Why, When & How? Hope Greenberg Center for Teaching & Learning June 11 & 18
The Plan Day One: –Introduction/history –XML: The bits and pieces –Working with XHTML –Roll our own Day Two: –Alphabet soup: DTDs, Stylesheets, XSL, XSLT, XPATH, XPOINTER XML: What, Why, When and How
A Little History Pretty Docs –Word Processors –Desktop Publishing Massive Docs –Mass Mailings –Technical Manuals Web Docs –Hypertext across the Internet XML: What, Why, When and How
A Little History SGML –Goldfarb, Mosher and Lorie, IBM 1970s –ISO 8879 in 1986 –Standard Generalized Markup Language A structural markup language for text documents …but then came the web… XML: What, Why, When and How
SGML/XML: What Mark up the structure Document determines mark up Separate content from presentation “Applications”: TEI, DOCBOOK, SMIL, (see Robin Cover for more) and the most popular is… XML: What, Why, When and How
XML: What 90% of the functionality, 10% of the size A small subset of SGML Designed with the web in mind For the developer: fewer rules For the user: a few more rules and all that software…or not… XML: What, Why, When and How
XML: The Pieces An xml file –Well-formed –Valid Parser DTD/Schema Stylesheet(s) XML: What, Why, When and How
XML: The Pieces XML: What, Why, When and How XML File Parser xhtml.xsl print.xsl pda.xsl web pda
XML File: The Pieces Declaration Processing Instructions Elements –(tag, attributes, content: PCDATA) Entities –Character, files, Comments CDATA XML: What, Why, When and How
XML File: The Pieces Declaration XML: What, Why, When and How
XML File: The Pieces Processing Instructions XML: What, Why, When and How
XML File: The Pieces Elements (tag, attributes, content: PCDATA) Hello World! How are you? XML: What, Why, When and How
XML File: The Pieces Entities –Character & Þ –Text: internal ©right; –Text or other: external XML: What, Why, When and How
XML File: The Pieces Comments CDATA >> & >]] XML: What, Why, When and How
Sample Well-Formed XHTML Document Sample Well-Formed XHTML Note that this document is not intended to be validated, so it has no Declaration. However, in order to be well-formed it does need to follow all the XML rules, so: all elements will have lower case tags, all tags will be closed, ALL tags must be nested properly, entity references are expressed properly: & and all attribute values will be in quotes, like this:
Sample Valid XHTML Document Sample Valid XHTML Note this document is intended to be validated, so it has a Declaration. It still needs to follow all the XML rules, so: all elements will have lower case tags, all tags will be closed, ALL tags must be nested properly, entity references are expressed properly: & and all attribute values will be in quotes, like this: ©right;
XHTML: Clean-up Time Let’s look at: Open Oxygen, and open hale.html Check for well-formedness Fix the errors, save, select, copy Open new file, choose xhtml-strict.dtd Paste in copied text Now validate and fix errors XML: What, Why, When and How
XHTML File: Some Rules All XML documents must have a single root element. XML tags are case sensitive. All XML elements must have a closing tag. or All XML elements must be properly nested. Attribute values must always be quoted. Valid files must have a DOCTYPE declaration. Valid files can only contain the elements and entities specified in the DTD/Schema. XML: What, Why, When and How
XML: Roll our own Consider the traditional memo: MEMORANDUM To: Jan Smith From: Kay Jones Subject: XML Class Date: June 11, 2003 We’re looking forward to our class at 9:30. Bring your own laptop if you would like to. Just be sure you have downloaded and installed Oxygen. XML: What, Why, When and How
XML: Roll our own Party Invitation (both sides) Recipe (with sidebar info) Play (consider special print) XML: What, Why, When and How
XML File: Some Rules XML documents use a self-describing syntax. XML tags are case sensitive. All XML elements must have a closing tag. All XML elements must be properly nested. All XML documents must have a root element. Attribute values must always be quoted. and think about what information you want to capture as well as how stylesheets might determine your choices XML: What, Why, When and How