Structured Documents
Week 3
LBSC 690
Information Technology
Outline
•	Questions

•	Finishing networks

•	Building the Web

•	Building a better Web
TCP/IP layer architecture
File Transfer Program (FTP)
•	Used to move files between machines
–	Upload (put) moves from client to server
–	Download (get) moves files from server to client

•	Available using GUI and command line interfaces

•	Normally requires an account on the server
–	But userid “anonymous” provides public access
–	Web browsers incorporate anonymous FTP (ftp://)

•	May automatically convert end-of-line conventions
–	Select “binary”
The World-Wide Web

Web Standards
•	HTML
–	How to write and interpret the information

•	URL
–	Where to find it

•	HTTP
–	How to get it

HyperText Transfer Protocol (HTTP)
•	Send request 
GET /path/file.html HTTP/1.0 
From: someuser@jmarshall.com 
User-Agent: HTTPTool/1.0 

•	Server response
HTTP/1.0 200 OK 
Date: Fri, 31 Dec 1999 23:59:59 GMT 
Content-Type: text/html 
Content-Length: 1354 
<html><body> <h1>Happy New Millennium!</h1> �c </body> </html> 
Uniform Resource Locator (URL)
•	Uniquely identify Web pages
–	Domain name
–	Directory path
–	File name 
HyperText Markup Language (HTML)
•	Simple document structure language for Web

•	Advantages
–	Adapts easily to different display capabilities
–	Widely available display software (browsers)

•	Disadvantages
–	Does not directly control layout
Rendering
•	Different devices have different capabilities
–	Desktop 
–	PDA
•	Rendering maps logical tags to physical layout
–	Controls line wrap, size, font…
•	Place the title in the page border
•	Render <h1> as 24pt Times
•	Render <strong> as bold
•	Somewhat browser-dependent
–	Internet Explorer and Netscape make different choices
“Hello World” HTML
Uploading a Web Page to WAM
•	Edit files on your local machine
–	Save early, save often!

•	Upload when you’re happy with it
–	Connect to “wam.umd.edu”
–	Change directory to “/pub/USERID”

•	View it at http://wam.umd.edu/~USERID
–	Refresh browser to see revised content
Hands On:
Learning HTML From Examples
•	Use Internet Explorer to find a page you like
–	http://www.glue.umd.edu/~oard 

•	On the “Page” menu select “View Source” (in IE7)
–	Opens a notepad window with the source

•	Compare HTML source with the Web page
–	 Observe how each effect is achieved
Hands On: “Adopt” a Web Page
•	Modify the HTML source using notepad
–	For example, change the page to yours
•	Save the HTML source on your “M:” drive
–	In the “File” menu, select “Save As”
–	Select “All Files” and name it “test.html”
•	FTP it to your ~/pub directory on WAM
–	sftp wam.umd.edu
–	cd ../pub/
–	put test.html
•	View it
–	http://www.wam.umd.edu/~(yourlogin)/test.html 
HTML Document Structure
•	“Tags” mark structure
–	<html>a document</html>
–	<ol>an ordered list</ol>
–	<i>something in italics</i>
•	Tag name in angle brackets <>
–	Not case sensitive
•	Open/Close pairs
–	Close tag is sometimes optional (if unambiguous)
Logical Structure Tags
•	Head 
–	Title

•	Body
–	Headers: <h1> <h2> <h3> <h4> <h5> 
–	Lists: <ol>, <ul> (can be nested)
–	Paragraphs:<p>
–	Definitions: <dt><dd>
–	Tables: <table> <tr> <td> </td> </tr> </table>
–	Role: <cite>, <address>, <strong>, …
Physical Structure Tags
•	Font
–	Typeface: <font face=“Arial”></font>
–	Size: <font size=“+1”></font>
–	Color: <font color=“990000”></font>
•	http://webmonkey.wired.com/webmonkey/reference/color_codes/Emphasis
–	Bold: <b></b>
–	Italics: <i></i>
(Hyper)Links
Hypertext “Anchors”
•	Internal anchors: somewhere on the same page
–	<a href=“#students”> Students</a>
•	Links to: <a name=“students”>Student Information</a>

•	External anchors: to another page 
–	<a href=“http://www.clis.umd.edu”>CLIS</a>
–	<a href=“http://www.clis.umd.edu#students”>CLIS students</a>

•	URL may be complete, or relative to current page
–	<a href=“video/week2.rm”>2</a>

•	File name part of URL is case sensitive (on Unix servers)
–	Protocol and domain name are not case sensitive
Images
•	<img src=“URL”> or <img src=“path/file”> 
–	<img src=“http://www.clis.umd.edu/IMAGES/head.gif”>
–	SRC: can be url or path/file
–	ALT: a text string
–	ALIGN: position of the image
–	WIDTH and HEIGHT: size of the image
•	Can use as anchor:	
–	 <a href=URL><img src=URL2></a>
•	Example: 
–	http://www.umiacs.umd.edu/~daqingd/Image-Alignment.html
Tables
Table Example
<table align=“center”>
<caption align=“right”>The caption</caption>    
	< tr align=“LEFT”>
		<th> Header1 </th>
		<th> Header2</th>
	</tr>
	<tr><td>first row, first item </td>
            <td>first row, second item</td></tr>
	< tr><td>second row, first item</td>
            <td>second row, second item</td></tr>
</table>
See also: http://www.umiacs.umd.edu/~daqingd/Simple-Table.html
Frames
•	Divide browser pages into separate sections 
–	Useful when you want to scroll separately

•	Each section can display an HTML page

•	Example 1: menu frame on the left side of a page
		<frameset cols=“10%,90%" >    	
			<frame src=“template.html"> 
			<frame src=“images.html">
		</frameset> 

•	Example 2:
–	http://www.hq.nasa.gov/alsj/frame.html
Cascading Style Sheets (CSS)
•	Specify appearance, based on structure

•	Style rules “cascade” from broad to narrow:
–	Browser’s default behavior
–	External style sheet
–	Internal style sheet
–	Inline style
Some Ways of Using CSS
•	Inline style:
–	Causes only the tag to have desired properties

•	Internal stylesheet:
–	Causes all tags to have the desired properties
Customizing Classes
•	Define a custom style for standard HTML tag
External Style Sheets
•	Store formatting metadata in a separate file
General Structure for CSS
•	Basic syntax:

•	Example:

	Causes
–	Font to be center-aligned
–	Font to be Arial and black
Designing Web Pages
•	Key design issues:
–	Content: What do you want to publish?
–	Style: How do you want to present it?
–	Syntax: How can you achieve that presentation?

•	Sources of information
–	Online tutorials (there are lots of these)
–	Technical materials (e.g., the W3C HTML spec)
Some Style Guidelines
•	Design for generic browsers
–	And test on every version you wish to support 
•	Provide appropriate “access points”
–	User needs and navigation strategies differ
•	Design useful navigational aids
–	A Web search may lead to the middle of a site
•	Include some indication of currency
–	Date of last update, “new” icons, etc.
•	Indicate who is responsible for the content
–	Helps readers assess authority
Some Accessibility Guidelines
•	Design for device independence
•	Maintain compatibility with earlier browsers
–	Provide alternative pages if necessary
•	Provide alternatives to aural and visual content
–	Alt tags for images, transcripts for audio
•	Make is easy for assistive devices to work
–	Use structural (rather than layout-oriented) markup
–	Give a title to each frame
–	Only use HTML tables for table data (not content layout)
–	Use markup to indicate language switching
Section 508 (Federal Web pages)
•	A text equivalent for every non-text element shall be provided. 
•	Equivalent alternatives for any multimedia presentation shall be synchronized with the presentation. 
•	Web pages shall be designed so that all information conveyed with color is also available without color. 
•	Documents shall be organized so they are readable without requiring an associated style sheet. 
•	Redundant text links shall be provided for each active region of a server-side image map. 
•	Client-side image maps shall be provided instead of server-side image maps except where the regions cannot be defined with an available geometric shape. 
•	Row and column headers shall be identified for data tables. 
•	Markup shall be used to associate data cells and header cells for data tables that have two or more logical levels of row or column headers. 
•	Frames shall be titled with text that facilitates frame identification and navigation. 
•	Pages shall be designed to avoid causing the screen to flicker with a frequency >2 Hz and <55 Hz. 
•	A text-only page, with equivalent information or functionality, shall be provided when compliance cannot be accomplished in any other way. The content shall be updated when the primary page changes 
•	When pages use scripting languages to display content or to create interface elements, the information provided by the script shall be identified with functional text that can be read by assistive technology. 
•	When a web page requires that an applet, plug-in or other application be present on the client system to interpret page content, the page must provide a link to a plug-in or applet that complies with the above. 
•	When electronic forms are designed to be completed on-line, the form shall allow people using assistive technology to access the information, field elements, and functionality required. 
•	A method shall be provided that permits users to skip repetitive navigation links. 
•	When a timed response is required, the user shall be alerted and given sufficient time to indicate more time is required. 
HTML Editors
•	Goal is to create Web pages, not learn HTML!
•	Several are available
–	Macromedia Dreamweaver available commercially
–	Microsoft Word (Page->Edit with Word in IE 7
–	Many more options available on www.tucows.com
•	Tend to use physical layout tags extensively
–	Detailed control can make hand-editing difficult
•	You may still need to edit the HTML file
–	Some editors use browser-specific features
–	Some HTML features may be unavailable
–	File names may be butchered when you upload
HTML Validators
•	Syntax checking: cross-browser compatibility
–	http://validator.w3.org
–	Try it on http://www.umd.edu 

•	Style checking: Section 508 compliance
–	http://www.cynthiasays.com/
–	Try it on http://www.umd.edu 
What’s Wrong with the Web?
•	HTML
–	Confounds structure and appearance (XML)

•	HTTP
–	Can’t recognize related transactions (Cookies)

•	URL
–	Links breaks when you move a file (PURL)

What’s a Document?
•	Content

•	Structure

•	Appearance

•	Behavior
History of Structured Documents
•	Early standards were “typesetting languages”
–	NROFF, TeX, LaTeX, SGML
•	HTML was developed for the Web
–	Too specialized for other uses
•	Specialized standards met other needs
–	Change tracking in Word, annotating manuscripts, …
•	XML seeks to unify these threads
–	One standard format for printing, viewing, processing
eXtensible Markup Language (XML)
•	SGML was too complex
•	HTML was too simple
•	Goals for XML
–	Easily adapted to specific tasks
•	Rendering Web pages
•	Encoding metadata
•	“Semantic Web”
–	Easily created
–	Easily processed
–	Easily read
–	Concise
A Family of Standards
•	Definition: DTD
–	Names known types of entities with “labels”
–	Defines part-whole and is-a relationships
•	Markup: XML
–	“Tags” regions of text with labels
•	Markup: XLink
–	Defines “hypertext” (and other) link relationships
•	Presentation: XSL
–	Specifies how each type of entity should be “rendered”
XHTML: Writing HTML as XML
XHTML Example
•	View “The Song of the Wandering Aengus” 
–	http://www.umiacs.umd.edu/~oard/teaching/690/spring08/notes/3/xml.htm

•	Built from three files
–	yeats01.xml 
–	poem01.dtd 
–	poem01.xsl  
XHTML Example
Document Type Definition (DTD)
Specifying Appearance: XSL
XLink Example
Some Basic Rules for XML
•	XML is case sensitive
•	XML declaration is the first statement
–	<?xml version="1.0"?>
•	An XML document is a “tree”
–	Must contain one root element
–	Other elements must be properly nested
•	All start tags must have end tags
•	Attribute values must have quotation marks
–	<item id=“33905”>
•	Certain characters are “reserved”
–	For example: &lt; is used to represent <
Multiple XML Namespaces
Really Simple Syndication (RSS)
•	XML format for distributing news headlines
Some Other XML Applications
•	Text Encoding Initiative
–	For adding annotation to historical manuscripts
–	http://www.tei-c.org/

•	Encoded Archival Description
–	To enhance automated processing of finding aids
–	http://www.loc.gov/ead/

•	Metadata Encoding and Transmission Standard
–	Bundles descriptive and administrative metadata
–	http://www.loc.gov/standards/mets/
Even More Uses of XML …
•	CML – Chemical Markup Language
•	CellML – biological models
•	BSML – bioinformatic sequences
•	MAGE-ML – MicroArray Gene Expression
•	XSTAR – for archaeological research 
•	MARCXML – MARC in XML
•	AML – astronomy markup language
•	SportsML – for sharing sports data
What’s Wrong with the Web?
•	HTML
–	Confounds structure and appearance (XML)

•	HTTP
–	Can’t recognize related transactions (Cookies)

•	URL
–	Links breaks when you move a file (URN)

Cookies
•	Servers know users by IP address and port
–	Because that’s where they send the Web pages

•	Cookies preserve “state”
–	Server sends data to the browser
–	Browser later responds with the same data
•	A unique code (server-side state)
•	Information about the user (client-side state)

•	Take a look:
–	Tools->Internet Options->Browsing history->Settings
Uniform Resource Names (URN): Persistent URL
www.purl.org
Summary
•	Learning to build simple Web pages is easy
–	Which is good news for the homework!

•	All documents are structured documents
–	But some expose the structure better than others

•	XML is a flexible markup language
–	Complete separation of structure and appearance
Before You Go!
•	On a sheet of paper (no names), answer the following question:

	What was the muddiest point in today’s class?