Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
XML Technology in E-Commerce
Lecture 1
WWW, HTML, CSS, XML, Meta-modeling
XML Technology in E-Commerce 2001
Lecture 1
Sheet 1
Lecture Outline
•
•
•
•
World Wide Web - facts, architecture;
HTML;
CSS;
XML
– Markups;
– Well-formedness;
– Meta-modeling;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 2
World Wide Web
• WWW
– Global hypertext project at CERN;
– Proposed by Tim Berners-Lee in 1989;
• Web Consortium (W3C) - www.w3.org
–
–
–
–
Founded in 1994;
Three hosts - MIT, INRIA, Keio University;
Leads the evolution of the Web;
More than 20 web-related specifications;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 3
World Wide Web
Architecture
HTTP request for Web Resource
Web Browser
Web Server
HTTP response - usually a Web page
• HTTP - Hypertext Transport Protocol;
• HTML - Hypertext Markup Language;
• URI - Uniform Resource Identifier - a naming scheme for
resources on the Web;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 4
HTML
<html>
Example
<head>
<title> XML Technology in E-Commerce</title>
</head>
<body>
<h1>Lecture 1</h1>
<p> Example of HTML</P>
<p> Resources: <a href=“http://www.w3.org”> W3C </a>
Web Consortium</p>
</body>
</html>
Other Examples - Deitel 2.4, page 26; 3.2, page 47
XML Technology in E-Commerce 2001
Lecture 1
Sheet 5
HTML
Forms
• Enable development of web applications - user interface is
presented by the browser;
• Web server handles form data through server extensions;
• Opens a possibility for dynamic web pages;
• CGI (Common Gateway Interface) - protocol for data
exchange between the server and its extensions (CGI
scripts);
• Popular languages for CGI programming - Perl, C, Python,
Java, VBScript, JavaScript;
Examples - Deitel 3.4, page 52
XML Technology in E-Commerce 2001
Lecture 1
Sheet 6
HTML
Links
Web
Resource
Web page
• Link has two ends (anchors) and direction;
• A element - sets up an anchor:
– <a href=“http://java.sun.com”>Java Home</a>
sets up a source anchor. href attribute contains an URI;
– <a name=“dest”> TOC </a> - sets up a destination
anchor;
• Link behavior - destination resource is retrieved and
displayed;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 7
HTML
<meta> tags usage
• Meta data about the document:
<meta name=“author” content=“John Smith”>
<meta name=“address” content=“an address”>
• HTTP response headers:
<meta http-equiv=“refresh” content=“1000;
http://www.foo.com”>
• Data for search agents:
<meta name=“keywords” content=“XML, WEB”>
XML Technology in E-Commerce 2001
Lecture 1
Sheet 8
HTML
Multimedia, extra functionality, editors
• Multimedia content - plug-in and ActiveX technology;
• Scripts - dynamic and interactive web pages on the
client side;
• Java Applets - programs executed in the browser
environment;
• HTML editors - FrontPage, Dreamweaver, NetObjects
Fusion, Adobe GoLive;
Demo: Editing web pages with FrontPage
XML Technology in E-Commerce 2001
Lecture 1
Sheet 9
CSS
Cascading Style Sheets
• Purpose - specify the layout of web pages;
• Benefits:
– Separate structure from presentation;
– Impose consistent look and feel to the entire site;
– Promotes reusability;
• Specifications:
– CSS level 1 and 2;
– CSS level 3 - work in progress;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 10
CSS
Declaration
• Inline styles
<p style=“font-size: 20 pt; color: blue”>
some text </p>
• style element
<style type=“text/css”>
p {font-size : 20pt; color : blue;}
</style>
• External style sheets
<head>
<link
rel=“stylesheet” type=“text/css”
href=“aStyle.css”>
</head>
XML Technology in E-Commerce 2001
Lecture 1
Sheet 11
CSS
Cascading and Inheritance
• Style origin:
– User agent (browser) default style sheet;
– User style;
– Author style;
• Cascading order - how to resolve conflicts
between style rules;
• Inheritance - an element inherits style properties
from its ancestors;
More info - Deitel 4.4, page 84
XML Technology in E-Commerce 2001
Lecture 1
Sheet 12
XML
XML, HTML, SGML
HTML Drawbacks:
• Fixed Tags Set
•
•
•
•
Relations between SGML,
HTML and XML:
Poor Linking
Does not support validation
Simple structures
Specifies only presentation
XML Technology in E-Commerce 2001
Lecture 1
Sheet 13
XML
Idea
<address>
<name> Sherlock Holmes
</name>
<street> Baker Street 221b </street>
<city> London </city>
<country> England </country>
</address>
XML Technology in E-Commerce 2001
Lecture 1
Sheet 14
XML
Basic terms
Annotated XML Specification:
http://www.xml.com/axml/testaxml.htm
XML Technology in E-Commerce 2001
Lecture 1
Sheet 15
XML
Characters and Markups
• Characters in the XML document form markups and character
data;
• Markups:
– start, end and empty element tags;
– entity and character references;
– comments;
– CDATA delimiters;
– Document type declarations;
– Processing Instructions;
• All other characters form character data;
XML Technology in E-Commerce 2001
Lecture 1
Sheet 16
XML
Elements and element’s content
<name attr1=“value1” >……..Content………..</name>
Start tag
Attribute
specification
Element’s
content
End tag
<img src=“anImage.gif” /> - Empty element
Element’s content:
• Only elements;
• Empty;
• Mixed (character data and other elements);
XML Technology in E-Commerce 2001
Lecture 1
Sheet 17
XML
Example
<person age=“45”>
<name>Sherlock Holmes</name>
<address>
<street>Baker Street 221b</street>
<zip>1111</zip>
<city>London</city>
<country>England</country>
</address>
<homepage href=“http://www.sherlock-holmes.co.uk/”/>
<note><em>Sherlock Holmes</em> and <em>Doctor Watson</em>
lived at 221b Baker Street between 1881-1904, according to the stories
written by <em>Sir Arthur Conan Doyle</em>.</note>
</person>
XML Technology in E-Commerce 2001
Lecture 1
Sheet 18
XML
Processing Instructions and CDATA Sections
• Processing Instructions:
<?xml:stylesheet type="text/css"
href="bach.css"?>
<?cocoon-process type="xslt"?>
• CDATA Sections:
<![CDATA[
<H1> Hello World! </H1> ]]>
<![CDATA[
if((x==0) && (y <2))
System.out.println(“Ok!”);
]]>
XML Technology in E-Commerce 2001
Lecture 1
Sheet 19
XML
Namespaces
• Purpose - resolve name collisions in a single XML
document;
• Definition - Set of names uniquely identified by URI, used
for element types and attribute names;
• Namespace declaration:
<html:html
xmlns:html=“http://www.w3.org/TR/REChtml40”>
<html:head>……….</html:head>
<html:body>……….</html:body>
</html:html>
Examples - Deitel 5.8, page 123
XML Technology in E-Commerce 2001
Lecture 1
Sheet 20
XML
Meta-modelling - well-formedness
EBNF
EBNF
Defines
WF Constraints
Defines
Pascal Grammar
XML Grammar
Defines
Defines
an XML Document
XML Technology in E-Commerce 2001
a Pascal Program
Lecture 1
Sheet 21
XML
Meta-modelling - validity
XML Technology in E-Commerce 2001
Lecture 1
Sheet 22
XML
Tool Support
• Browser support:
– Netscape - XML, CSS1, CSS2 (partly);
– IE 5 - XML, CSS1, CSS2 (partly), XSLT;
– Opera - XML, CSS1, CSS2(partly);
• XML Editors:
–
–
–
–
XML Spy 3.5;
XMetal;
Epic;
FrameMaker;
Demo: Visualizing XML files in IE5, editing with XML Spy
XML Technology in E-Commerce 2001
Lecture 1
Sheet 23
Summary
• Today’s Web - HTTP, URI, HTML, CSS;
• XML is a technology for creating markup languages;
• XML documents contain character data and markups;
• Elements are the main building blocks for the document
structure;
• Document well-formedness means conformance to the
XML grammar and constraints;
Read: Deitel 1..5, Well-formedness and Validity of XML
Documents
Skip: Deitel 3.3, 3.5, 3.7, 3.9, 3.10, 4.6 .. 4.10;
Assignment: Deitel Ex 5.4 and Ex 5.7, pages 132, 133
XML Technology in E-Commerce 2001
Lecture 1
Sheet 24