XML + Ajax Week 13 INFM 603.

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
Advertisements

HyperText Markup Language (HTML). Introduction to HTML Hyper Text Markup Language HTML Example The structure of an HTML document Agenda.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
1 eVenzia Technologies Learning HTML, XHTML & CSS Chapter 1.
XML eXtensible Markup Language ©2010 Paula Schales.
Structured Documents Week 3 LBSC 690 Information Technology.
Debugging and Ajax Session 7 INFM 718N Web-Enabled Databases.
LBSC 690 Session #5 Metadata and XML Jimmy Lin The iSchool University of Maryland Wednesday, October 1, 2008 This work is licensed under a Creative Commons.
LBSC 690: Session 6 CSS, XML/XSLT Jimmy Lin College of Information Studies University of Maryland Monday, October 15, 2007.
F DIGITAL MEDIA: COMMUNICATION AND DESIGN INTRODUCTION TO XML AND XHTML.
LBSC 690 Session #6 CSS, XML/XSLT Jimmy Lin The iSchool University of Maryland Wednesday, October 8, 2008 This work is licensed under a Creative Commons.
Introduction to XML: Yong Choi CSU Bakersfield.
Introduction to XML This material is based heavily on the tutorial by the same name at
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
XML, Ajax, Web Services, Semantic Web
Creating a Basic Web Page
Content Management Systems Week 5 LBSC 690 Information Technology.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
GeoAtom, OGC, and the Geospatial Enablement of Everything Joshua Lieberman, Traverse Technologies & Open Geospatial Consortium.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
XML Week 6 INFM 603. Agenda Questions Events in JavaScript XML Speed dating.
Ajax and Ruby on Rails Session 9 INFM 603.
Week 4 LBSC 690 Information Technology
Representation Week 6 LBSC 671 Creating Information Infrastructures.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
CS134 Web Design & Development Creating a Basic Web Page Mehmud Abliz.
CP2022 Multimedia Internet Communication1 HTML and Hypertext The workings of the web Lecture 7.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
CSS Basic (cascading style sheets)
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
HTML | DOM. Objectives  HTML – Hypertext Markup Language  Sematic markup  Common tags/elements  Document Object Model (DOM)  Work on page | HTML.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
XHTML 1.1  Derived from Standard Generalized Markup Language (SGML) of ISO  XHTML concerned primary with content rather than presentation and style 
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
XML Introduction. What is XML? XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is a markup language much like.
XML Basics A brief introduction to XML in general 1XML Basics.
Web Development 101 Presented by John Valance
Google Data Protocol Guy Mark Lifshitz. Motivation Google’s Mission: – Organize the world’s information – Make information universally accessible – Provide.
RSS Really Simple Syndication. Overview RSS is a web content syndication format RSS documents are XML and must conform to the xml 1.0 recommendation RSS.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 Alternative view on Internet Computing Web 1.0 –Web 1.0 is first generation, Web Information based. Driven by Information provider. Web 2.0 Ajax enabled.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Created by Cheryl M. Hughes The Web Wizard’s Guide to XHTML by Cheryl M. Hughes.
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
Web Services and Linked Data INFM 603 Session 10.
Basic HTML Document Structure. Slide 2 Goals (XHTML HTML5) XHTML Separate document structure and content from document formatting HTML 5 Create a formal.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Web Design – Week 2 Introduction to website basics Website basics: How the Web Works Client / server architecture Packet switching URL components.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Web Design Principles 5 th Edition Chapter 3 Writing HTML for the Modern Web.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Unit 4 Representing Web Data: XML
XML Related Technologies
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Chapter 7 Representing Web Data: XML
Introduction to World Wide Web
Web Development 101 Workshop
Presentation transcript:

XML + Ajax Week 13 INFM 603

Agenda Questions XML Web Services Ajax CSS? Drupalcon Project discussion

History of Structured Documents Early standards were “typesetting languages” NROFF, TeX, LaTeX, SGML HTML was developed for the Web 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

The XML Family Tree XML SGML . . . . . . SMIL VoiceXML RSS XHTML MathML RDF HTML TEI . . . . . . XML SGML

Some 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/

XHTML: Cleaning up HTML <?xml version="1.0" encoding="iso-8859-1"?> <html xmlns="http://www.w3.org/TR/xhtml1" > <head> <title> Title of text XHTML Document </title> </head> <body> <div class="myDiv"> <h1> Heading of Page </h1> <p> here is a paragraph of text. I will include inside this paragraph a bunch of wonky text so that it looks fancy. </p> <p>Here is another paragraph with <em>inline emphasized</em> text, and <b> absolutely no</b> sense of humor. </p> <p>And another paragraph, this one with an <img src="image.gif" alt="waste of time" /> image, and a <br /> line break. </p> </div> </body></html>

Really Simple Syndication (RSS) <?xml version="1.0"?> <rss version="2.0"> <channel> <title>Lift Off News</title> <link>http://liftoff.msfc.nasa.gov/</link> <description>Liftoff to Space Exploration.</description> <language>en-us</language> <pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate> <lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <generator>Weblog Editor 2.0</generator> <managingEditor>editor@example.com</managingEditor> <webMaster>webmaster@example.com</webMaster> <ttl>5</ttl> <item> <title>Star City</title> <link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link> <description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City.</description> <pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate> <guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid> </item> </channel> </rss> See example at http://www.nytimes.com/services/xml/rss/

Atom Feeds <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <subtitle>A subtitle.</subtitle> <link href="http://example.org/feed/" rel="self"/> <link href="http://example.org/"/> <updated>2003-12-13T18:30:02Z</updated> <author> <name>John Doe</name> <email>johndoe@example.com</email> </author> <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id> <entry> <title>Atom-Powered Robots Run Amok</title> <link href="http://example.org/2003/12/13/atom03"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <summary>Some text.</summary> </entry> </feed>

Synchronized Multimedia Integration Language (SMIL) Window controls (in <head>) Controlling layout: <region>, <root-layout> Timeline controls (in <body>) Sequence control: <seq>, <excl>, <par> Timing control: <begin>, <end>, <dur> Content types (in <body>) <audio>, <video>, <img>, <ref>

XML: A Family of Standards Definition: DTD or Schema Known types of entities with “labels” Defines part-whole and is-a relationships Markup: XML “Tags” regions of text with labels Presentation: XSLT Specifies how each type of entity should be rendered

Some Basic Rules for All 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: < is used to represent <

XML Example View “The Song of the Wandering Aengus” See related materials with this week’s slides Built from three files yeats01.xml poem01.dtd poem01.xsl What is XML? What

XML Example <?xml version="1.0"?> <!DOCTYPE POEM SYSTEM "poem01.dtd"> <?xml-stylesheet type="text/xsl" href="poem01.xsl"?> <POEM> <TITLE>The Song of Wandering Aengus</TITLE> <AUTHOR> <FIRSTNAME>W.B.</FIRSTNAME> <LASTNAME>Yeats</LASTNAME> </AUTHOR> <STANZA> <LINE>I went on to the hazel wood,</LINE> <LINEIN>Because a fire was in my head,</LINEIN> <LINE>And cut and peeled a hazel wand,</LINE> </STANZA> </POEM>

Document Type Definition (DTD) <!ELEMENT poem ( (title, author, stanza)* )> <!ELEMENT title (#PCDATA) > <!ELEMENT author (firstname, lastname) > <!ELEMENT firstname (#PCDATA) > <!ELEMENT lastname (#PCDATA) > <!ELEMENT stanza (line+ | linein+) > <!ELEMENT line (#PCDATA) > <!ELEMENT linein (#PCDATA) > DTD defines a document type in 1. Its vocabulary, what kind of elements are allowed in the document type. 2. It defines a content model for each element. A content model is a pattern that tells what elements or data can go inside an element, in what order, in what number, and whether they are required or optional. Think of this as the “grammar” of the attribute. #PCDATA => parsed character data. The characters will be checked by an XML parser for entity reference, which will then be replaced with their entity values #PCDATA span of text a,b a followed by b a|b either a or b a* 0 or more a’s a+ 1 or more a’s

Specifying Appearance: XSL(T) <xsl:template match="POEM"> <HTML> <BODY BGCOLOR="#FFFFCC"> <xsl:apply-templates/> </BODY> </HTML> </xsl:template> <xsl:template match="TITLE"> <H1> <FONT COLOR="Green"> <xsl:value-of/> </FONT> </H1> </xsl:template> Extensible Stylesheet language XSL http://www.w3.org/Style/CSS-vs-XSL

Multiple XML Namespaces <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <rss:channel rdf:about="http://www.xml.com/xml/news.rss"> <rss:title>XML.com</rss:title> <rss:link>http://xml.com/pub</rss:link> <dc:description> XML.com features a rich mix of information and services for the XML community. </dc:description> <dc:subject>XML, RDF, metadata, information syndication services</dc:subject> <dc:identifier>http://www.xml.com</dc:identifier> <dc:publisher>O'Reilly & Associates, Inc.</dc:publisher> <dc:rights>Copyright 2000, O'Reilly & Associates, Inc.</dc:rights> </rss:channel> </rdf:RDF> Example from http://www.xml.com/pub/a/2000/10/25/dublincore/

XML DOM Parser (IE) doc = new ActiveXObject(“Msxml2.DOMDocument.6.0”); doc.async = false; doc.load(“sports.xml”); result = doc.selectNodes (“/sports/game/name”); for (i in result) { document.writeln(result.item(i).text + “<br />”); }

Resource Description Framework <http://dbpedia.org/resource/Ayn_Rand> <http://dbpedia.org/ontology/deathDate> "1982-0306"^^<http://www.w3.org/2001/XMLSchema#date> . <http://dbpedia.org/resource/Ayn_Rand> <http://dbpedia.org/ontology/birthPlace> <http://dbpedia.org/resource/Russian_Empire> . <http://dbpedia.org/resource/Ayn_Rand> <http://dbpedia.org/ontology/birthPlace> <http://dbpedia.org/resource/Saint_Petersburg,_Russia> . <http://dbpedia.org/resource/Ayn_Rand> <http://dbpedia.org/ontology/birthDate> "1905-02-02"^^<http://www.w3.org/2001/XMLSchema#date> . <http://dbpedia.org/resource/Ayn_Rand> <http://purl.org/dc/elements/1.1/description> "novelist, philosopher, playwright, screenwriter"@en . <http://dbpedia.org/resource/Ayn_Rand> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . <http://dbpedia.org/resource/Ayn_Rand> <http://xmlns.com/foaf/0.1/givenName> "Ayn"@en . <http://dbpedia.org/resource/Ayn_Rand> <http://xmlns.com/foaf/0.1/surname> "Rand"@en . <http://dbpedia.org/resource/Ayn_Rand> <http://xmlns.com/foaf/0.1/name> "Ayn Rand"@en .

Representing Complex Structures Concurrent hierarchies Standoff annotation

Networked Data Exchange Service-Oriented Network of Workstations Web API Web services Service Oriented Architecture Content-oriented Web scraping Microformats Data repositories Linked data Mashups

The World’s Largest Supercomputer

SETI@Home: Network of Workstations

Web Services Stateful: RESTful:

Web Services

WSDL <?xml version="1.0" encoding="UTF-8"?> <definitions name="HugeIntegerService" targetNamespace="http://hugeinteger.ch28.iw3htp4.deitel.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://hugeinteger.ch28.iw3htp4.deitel.com/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types><xsd:schema> <xsd:import xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" schemaLocation="http://pjd:8080/HugeInteger/HugeIntegerService/ __container$publishing$subctx/WEB-INF/wsdl/HugeIntegerService_schema1.xsd" namespace="http://hugeinteger.ch28.iw3htp4.deitel.com/"/> </xsd:schema> </types> <message name="add"><part name="parameters" element="tns:add"/></message> <message name="addResponse"><part name="parameters" element="tns:addResponse"/> </message> “ … <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="add"><soap:operation soapAction=""/> <input><soap:body use="literal"/></input> <output><soap:body use="literal"/></output></operation> <operation name="equals"><soap:operation soapAction=""/> <input><soap:body use="literal"/></input><output> <soap:body use="literal"/></output> </operation> … <service name="HugeIntegerService"> <port name="HugeIntegerPort" binding="tns:HugeIntegerPortBinding"> <soap:address xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" location="http://pjd:8080/HugeInteger/HugeIntegerService"/> </port> </service> </definitions>

Services Oriented Architecture

Networked Data Exchange Service-Oriented Network of Workstations Web API Web services Service Oriented Architecture Content-oriented Web scraping Microformats Data repositories Linked data Mashups

Web Scraping

Microformats Human- and Machine-Readable Human-Readable <div id="contact"> <h2>Contact Me</h2> <p> You can contact me via email to <a href="mailto:jane@example.com">jane@example.com</a>, or send stuff to me at the following address:</p> <p>255 Some Street,<br /> Some Place,<br /> Some Town</p> </div> <div id="contact" class="vcard"> <h2>Contact Me</h2> <h3 class="fn">Jane Doe</h3> <p> You can contact me via email to <a class="email" href="mailto:jane@example.com">jane@example.com</a>, or reach me at the following address:</p> <div class="adr"> <div class="street-address">255 Some Street</div> <div class="locality">Some Town</div> <div class="region">Some Place</div> </div> </div>

Data.gov

Linked Open Data

Networked Data Exchange Service-Oriented Network of Workstations Web API Web services Service Oriented Architecture Content-oriented Web scraping Microformats Data repositories Linked data Mashups

Mashups

Server-side Programming Interchange Language Client-side Programming Relational normalization Structured programming Software patterns Object-oriented design Functional decomposition Client Hardware (PC, Unix) (MySQL) (PHP) (HTML, XML) (JavaScript) (IE, Firefox) (PC) Business rules Interaction Design Interface Web Browser Server-side Programming Interchange Language Client-side Programming Database Server Hardware

Sajax: Simple Ajax for PHP http://www.modernmethod.com/sajax/ <? require("Sajax.php"); function multiply($x, $y) { return $x * $y; } sajax_init(); // $sajax_debug_mode = 1; sajax_export("multiply"); sajax_handle_client_request(); ?>

<html><head> <title>Multiplier</title> <script> <? sajax_show_javascript(); ?> function do_multiply_cb(z) { document.getElementById("z").value = z; } function do_multiply() { // get the folder name var x, y; x = document.getElementById("x").value; y = document.getElementById("y").value; x_multiply(x, y, do_multiply_cb); </script> </head> <body> <input type="text" name="x" id="x" value="2" size="3"> * <input type="text" name="y" id="y" value="3" size="3"> = <input type="text" name="z" id="z" value="" size="3"> <input type="button" name="check" value="Calculate" onclick="do_multiply(); return false;"> </body></html>

Communication methods GET/POST (client to server) – simple data XML (the “X” in AJAX) Structured data between client and server. Client responsible for updating page JSON – a light-weight alternative to XML HTML (server to client) – server sends rendered result Widget – GUI library hiding (some) AJAX details (e.g. DoJo)

Model-View-Controller

Object-relational model (ORM) In naïve webapp, data has three lives: Row in database Variable in program (field of object) Parameter in request (HTTP POST) ORM wraps database in object-oriented code (table rows look like objects) MVC allows near-transparent extension to Web forms, parameters.

CSS Separating content and structure from appearance Rules for defining styles “cascade” from broad to narrow: Browser default External style sheet Internal style sheet Inline style

Basics of CSS Basic syntax: Example: Causes selector {property: value} Font to be center-aligned Font to be Arial and black selector {property: value} HTML tag you want to modify… The property you want to change… The value you want the property to take p { text-align: center; color: black; font-family: arial }

Different Ways of Using CSS Inline style: Causes only this tag to have the desired properties Internal stylesheet: Causes all tags to have the desired properties <p style="font-family:arial; color:blue“>…</p> … <head>… <style type="text/css" > p { font-family:arial; color:blue} </style> </head> <body> <p>…</p>

Customizing Classes Ability to define customized styles for standard HTML tags: … <head>… <style type="text/css"> p.style1 { font-family:arial; color:blue} p.style2 { font-family:serif; color:red} </style> </head> <body> <p class=“style1“>…</p> <p class=“style2“>…</p>

External Style Sheets Store formatting metadata in a separate file mystyle.css p.style1 { font-family:arial; color:blue} p.style2 { font-family:serif; color:red} … <head>… <link rel="stylesheet" href="mystyle.css" type="text/css" /> </head> <body> <p class=“style1">…</p> <p class=“style2">…</p>