Professional Documents
Culture Documents
Internet &
Intranet Applications
5 Homework (30%)
A midterm exam (30%)
November 16th 2007
bkurt@itu.edu.tr
Copyleft
Copy
left 2005-2007
version 1.3
Course Outline
1. Networking Fundamentals
18:30-21:30, Friday
3. XML
http://www.cs.itu.edu.tr/~kurt/Courses/bte550
5. HTML
6. XHTML
7. XPath and XSLT
8. CSS
9. Multimedia Standards: Image, Video, Audio, Animation, VR, 3D
10. Dynamic HTML: JavaScript
11. Web Applications: Forms, JSP, PHP
3
Reference
f
Networking Funndamentals
Demonstration
Objectives (Cont.)
Exercise
10
Networking Funndamentals
Networking Fundamentals
WWW Request-Response
1
Networking Funndamentals
Objectives
Web Browser
BTE550 Internet and Intranet Applications
11
Networking Funndamentals
NIC
Media
Protocol
NOS
Connectivity devices
LAN
MAN
WAN
Physical topology
Logical topology
Web Server
12
Sending E-Mail
Client A
E-mail
Server
Networking Funndamentals
Networking Funndamentals
E-mail
Server
Client B
13
Networking Funndamentals
Networking Funndamentals
Internet
Branch Office
Application
Presentation
Session
T
Transport
t
Network
Data Link
Physical
14
Transport
Network
Data Link
Physical
16
Reduces complexity
Standardizes interfaces
Facilitates modular engineering
Ensures interoperable technology
Accelerates evolution
Simplifies teaching and learning
Networking Funndamentals
Branch
Office
Floor 2
Server
Farm
Floor 1
ISDN
Remote
17
Computer Networks
1
Session
Main Office
Networking Funndamentals
Mobile Users
Presentation
Home
Office
Application
Application
Presentation
Session
Transport
p
Network
Data Link
Physical
Campus
15
18
Presentation
Networking Funndamentals
Networking Funndamentals
Application
Presentation
Session
Interhost Communication
Transport
End-to-End Connections
Network
Data Link
Physical
Application
Session
Transport
Network
Structures data
Data Link
Physical
Formats data
Data Representation
Data Delivery
Provides connectivity and path
selection between two host
systems
Routes data packets
Selects best path to deliver data
19
Presentation
Session
Transport
Network
Data Link
Physical
Networking Funndamentals
Networking Funndamentals
Data Representation
Interhost Communication
Establishes, manages, and
terminates sessions
between applications
20
Application
Presentation
Session
Interhost Communication
Transport
End-to-End Connections
Network
Data Link
Physical
6
5
Presentation
Session
Transport
Network
Data Link
Physical
Data Representation
Interhost Communication
End-to-End
d to d Co
Connections
ect o s
Handles transportation issues between hosts
Ensures data transport reliability
Establishes, maintains and terminates virtual
circuits
Provides reliability through fault detection
and recovery information flow control
21
Networking Funndamentals
Application
Data Delivery
Access to Media
Defines how data is formatted for
transmission and how access to
the network is controlled
23
Data Representation
Networking Funndamentals
Application
22
Application
Presentation
Session
Interhost Communication
Transport
End-to-End Connections
Network
Data Delivery
Data Link
Access to Media
Physical
Data Representation
Binary Transmission
Defines the electrical, mechanical,
procedural, and functional specifications
for activating, maintaining, and
deactivating the physical link.
24
Data Encapsulation
TCP/IP Model
1
User Data
7
Application
Presentation
Session
Transport
Network
Data Link
Physical
L4
HDR
L4
L3
HDR HDR
L2
L3
L4
HDR HDR HDR
L5
HDR
L5
HDR
L5
HDR
L5
HDR
L6
HDR
L6
HDR
L6
HDR
L6
HDR
L6
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
User Data
User Data
User Data
User Data
User Data
User Data
Application
Networking Funndamentals
Networking Funndamentals
Sender
FCS
Bits
Presentation
Internet
Network Access
HDR = header
25
Data De-Encapsulation
Receiver
OSI Model
Networking Funndamentals
1
Networking Funndamentals
28
User Data
7
Application
Presentation
i
Session
Transport
Network
Data Link
Physical
L4
HDR
L3
L4
HDR HDR
L2
L3
L4
HDR HDR HDR
L5
HDR
L5
HDR
L5
HDR
L5
HDR
L6
HDR
L6
HDR
L6
HDR
L6
HDR
L6
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
L7
HDR
User Data
User Data
User Data
User Data
User Data
User Data
FCS
Application
Presentation
Application
Application
Layers
Protocols
Session
Transport
Transport
Internet
Network
Network
Access
Networks
Bits
Data Link
Data Flow
Layers
Physical
HDR = header
26
Peer-to-Peer Communication
Summary
Application
Application
Presentation
Presentation
Session
Transport
Network
Data Link
Physical
Segments
Packets
Frames
Bits
Network
Networking Funndamentals
Networking Funndamentals
Receiver
Sender
29
Session
Transport
Network
Data Link
Physical
27
30
Repeater
Networking Funndamentals
Networking Funndamentals
Summary (Cont.)
31
Networking Funndamentals
Networking Funndamentals
Summary (Cont.)
32
35
Networking Funndamentals
Networking Funndamentals
Summary (Cont.)
34
33
36
Segment 1
Networking Funndamentals
Networking Funndamentals
Summary
Bridge
Segment 2
Corporate
Internet
37
1
Networking Funndamentals
Networking Funndamentals
38
No Access
to HQ
AAA
Server
Networking Funndamentals
1
Networking Funndamentals
41
Summary (Cont.)
California
Corporate
Headquarters
New
Hampshire
Firewalls
Allow
Access
to HQ
40
Summary (Cont.)
Switch
Massachusetts
Allow
Access
to HQ
Vermont
BTE550 Internet and Intranet Applications
39
42
Bus Topology
Ring Topology
Networking Funndamentals
Networking Funndamentals
Star Topology
Physical Topologies
Star Topology
Mesh Topology
43
Logical Topologies
Extended-Star Topology
Internet
1
Main
Server
Main
Switch
Networking Funndamentals
Networking Funndamentals
46
E2
E0
E1
F
E
Workgroup
Switch
Repeater
A
C
H
G
Bridge
J
I
44
Networking Funndamentals
Networking Funndamentals
Ring Topology
Bus Topology
47
45
48
Networking Funndamentals
Networking Funndamentals
Summary
Dual-Ring Topology
49
Networking Funndamentals
Networking Funndamentals
Summary (Cont.)
Full-Mesh Topology
50
53
1
Networking Funndamentals
Communications Protocol
Networking Funndamentals
Partial-Mesh Topology
52
51
Host
Host
TCP
54
FTP,
Telnet,
SMTP
Presentation
FTP *
NetBIOS
Session
4
Transport
TCP
Network
IP
OSPF
IGRP
RIP
Data-link
LLC
Physical
TFTP *
DNS, SNMP
Application
NFS
Networking Funndamentals
1
Networking Funndamentals
File Transfer
7
E-Mail
SMTP
Application
Remote Login
Telnet *
rlogin *
Transport
Network Management
SNMP *
Network
Name Management
Data Link
DNS*
Physical
55
TCP Characteristics
Summary
1
Connection-Oriented Protocol
Full-Duplex Operation
Networking Funndamentals
Networking Funndamentals
58
Error Checking
Sequencing
Acknowledgments
Flow Control
Packet Recovery
56
59
UDP Characteristics
Minimal Service
Networking Funndamentals
Networking Funndamentals
Network Host
Unreliable
Not-Guaranteed
Direct Access to Datagrams
57
1
2
3
2.1
1.2
3.1
1.1
1.3
60
10
IP Address Range
IP Address Class
Networking Funndamentals
Networking Funndamentals
Dotted-Decimal Notation
IP Address Range
(First octet decimal value)
Class A
1-126 (00000001-01111110) *
Class B
128-191 (10000000-10111111)
Class C
192-223 (11000000-11011111)
Class D
224-239 (11100000-11101111)
Class E
240-255 (11110000-11111111)
*127 (011111111) is a Class A address reserved for loopback testing and cannot be assigned to a network.
61
IP Address Classes
No. of bits
Network no.
Host no.
Network Addresses
24
Class A:
Class B:
No. of bits
Class C:
14
Network no.
21
Network no.
No of bits 1
No.
28
Class D:*
Address
No. of bits 1
28
Class E:**
Address
16
Host no.
8
Host no.
Networking Funndamentals
Networking Funndamentals
No. of bits
62
32 Bits
NETWORK
HOST
8 Bits
1 Byte
8 Bits
1 Byte
16
1 Byte
8 Bits
Class A:
Class B:
Class C:
65
1
1 Byte
8 Bits
Networking Funndamentals
1 Byte
8 Bits
8 Bits
1 Byte
Broadcast Address
1 Byte
8 Bits
8 Bits
1 Byte
172
Networking Funndamentals
64
32 Bits
NETWORK
8 Bits
1 Byte
HOST
8 Bits
1 Byte
N
172
8 Bits
1 Byte
16
8 Bits
1 Byte
255
N
172
16
255
63
66
11
The Internet
In the early days of computer
networking, local area networks (LANs)
were created to share resources among
members of a particular institution. These
networks were constrained to short
distances.
Class
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
Int. To Web A
App. Tech.
Networking Funndamentals
Private IP Addresses
67
Networking Funndamentals
70
Client-Server Architecture
Other
Classes
12.5%
Int. To Web A
App. Tech.
Class C
12.5%
Class B
25%
Class A
50%
With Class A and B addresses virtually exhausted, Class C addresses (12.5 percent of the total
space) are left to assign to new networks.
BTE550 Internet and Intranet Applications
68
71
Introduction to Web
Application Technologies
Int. To Web A
App. Tech.
72
12
73
76
Int. To Web A
App. Tech.
Int. To Web A
App. Tech.
Int. To Web A
App. Tech.
Int. To Web A
App. Tech.
HTML
74
Web Applications
2
Int. To Web A
App. Tech.
Int. To Web A
App. Tech.
77
75
78
13
Usually, the browser needs to send data to the CGI program on the
server.
The CGI specification defines how the data is packaged and sent in
the HTTP request to the server. This data is usually typed into the
Web browser in an HTML form.
program
g
to execute. This might
g be
The URL determines which CGI p
a script or an executable file.
The CGI program parses the CGI data in the request, processes the
data, and generates a response (usually an HTML page). The CGI
response is sent back to the Web server, which wraps the response
in an HTTP response. The HTTP response is sent back to the Web
browser.
Int. To Web A
App. Tech.
Int. To Web A
App. Tech.
79
82
Int. To Web A
App. Tech.
80
Overview of XML
Content
Define XML
Compare and contrast HTML and XML
Identify characteristics of XML documents
XM
ML
Int. To Web A
App. Tech.
81
84
14
What is XML?
XM
ML
XM
ML
85
What is no?
88
XM
ML
What is yes?
XM
ML
<ul>
<li> 9906789 </li>
<li>Adam</li>
<li>adam@unl.ac.uk</li>
@
<li>yes - final </li>
</ul>
<ul>
<li> 9806791 </li>
<li>Adrian</li>
<li>adrian@unl.ac.uk</li>
<li>no</li>
</ul>
</body></html>
<student_list>
<student>
<id> 9906789 </id>
<name>Adam</name>
<email>adam@unl.ac.uk</email>
<bsc level=final>yes</bsc>
</student>
/
<student>
<id> 9806791 </id>
<name>Adrian</name>
<email>adrian@unl.ac.uk</email>
<bsc>no</bsc>
</student>
Only data
Data is self-describing
Custom tags describe content
(you can/will define your own tags)
Easy to locate data
(e.g. all BSc students)
</student_list>
86
XM
ML
<ul>
<li> 9906789 </li>
<li>Adam</li>
<li>adam@unl ac uk</li>
<li>adam@unl.ac.uk</li>
<li>yes - final </li>
</ul>
<ul>
<li> 9806791 </li>
<li>Adrian</li>
<li>adrian@unl.ac.uk</li>
<li>no</li>
</ul>
</body>
</html>
BTE550 Internet and Intranet Applications
Portable Data
Portable Code
<html>
<head> </head>
<body>
<h2>Student List</h2>
89
students.xml
Specifies structure of the data
XM
ML
students.html
Specifies visual presentation
<student>
<id> 9806791 </id>
<name>Adrian</name>
<email>adrian@unl.ac.uk</email>
<bsc>no</bsc>
</student>
<first>Sridhar</first>
<last>Reddy</last>
</name>
<title>Staff Engineer</title>
<organization>Market Development Engineering</organization>
<address> 901 San Antonio Road, </address>
<email>sridhar.reddy@sun.com</email>
</employee>
</student_list>
</employees>
87
90
15
3
XM
ML
XM
ML
client
91
94
XM
ML
Portable
code
Ubiquitous
communication
92
POP - MOM
Portable data
Works anywhere
Lingua franca of the Internet
Multiple vendors
Open development process:
World Wide Web Consortium (W3C)
XM
ML
XML
XM
ML
95
93
96
16
XML
XM
ML
XML Standards
Through Standard organizations
W3C, IETF, OASIS, UN/CEFACT
XM
ML
97
XM
ML
W3C
<?xml version="1.0"?>
Data Oriented
<invoice
invoice>
<orderDate
orderDate>2005-01-01</orderDate
orderDate>
<shipDate
shipDate>2005-01-05</shipDate
shipDate>
<billingAddress
billingAddress>
<name
name>Paul Biron</name
name>
<street
street>123 IBM Avenue</street
street>
<city
city>Hawthorne</city
city>
<state
state>NY</state
state>
<zip
zip>10532</zip
zip>
This document is text and might
</billingAddress
billingAddress>
well be stored in a text file. You
<voice
voice>555-1234</voice
voice>
can edit this file with any
<fax
fax>555-4321</fax
fax>
standard text editor
</invoice
invoice>
98
XML Parser
XM
ML
101
XML
XM
ML
100
XM
ML
Standardization Activities
<orderDate
orderDate>2005-01-01</orderDate
orderDate>
element
start-tag
end-tag
BTE550 Internet and Intranet Applications
99
102
17
XM
ML
XM
ML
103
106
XM
ML
3
XM
ML
104
XM
ML
XM
ML
107
105
108
18
XML Characteristics
Elements
<PurchaseOrder
PurchaseOrder>
</PurchaseOrder
PurchaseOrder>
XM
ML
XML Fundamentals
109
XML Characteristics
Elements
Text
XM
ML
XM
ML
112
<PurchaseOrder>
<description>Battery</description>
<quantity>9</quantity>
<price>60</price>
person.xml
Your operating system may or may not like these names
But an XML parser won't care
BTE550 Internet and Intranet Applications
110
XML Characteristics
XM
ML
XM
ML
<person
person>
Alan Turing
</person
person>
113
111
Elements
Text
Attributes
<ShoeOrder id="4040458"
id="4040458">
<color>Brown</color>
<size>9</size>
<width>AA</width>
</ShoeOrder>
114
19
Processing Instruction
<?xml version="1.0"?>
<!DOCTYPE order SYSTEM "order.dtd">
Document Type Definition (DTD)
<order >
<book isbn="0-201-34285-5">
<title>The XML Companion</title>
Attribute
<author>Neil Bradley</author>
y
<publisher>Addison-Wesley</publisher>
</book>
Element
</order>
<!-- This is a comment -->
Comment
Case Sensitivity
XM
ML
3
XM
ML
Document R
Root Element
An XML Document
115
XML Trees
Every XML document has one element that does not have
a parent: root element
3
XM
ML
XM
ML
XML Elements
116
<invoice
invoice>
<orderDate
orderDate>2005-01-01</orderDate
orderDate>
<shipDate
shipDate>2005-01-05</shipDate
shipDate>
<billingAddress
billingAddress>
<name
name>Paul Biron</name
name>
<street
street>123 IBM Avenue</street
street>
<city
city>Hawthorne</city
city>
<state
state>NY</state
state>
<zip
zip>10532</zip
zip>
</billingAddress
billingAddress>
<voice
voice>555-1234</voice
voice>
<fax
fax>555-4321</fax
fax>
</invoice
invoice>
119
<CC:LunchMenu xmlns:Camp=http://catering.com/CC>
...
<CC:MainCourse>. . .</CC:MainCourse>
fatura
3
XM
ML
3
XM
ML
XML Namespaces
118
sipari--tarihi
sipari
gnderim--tarihi
gnderim
isim
117
cadde
fatura--adresi
fatura
ile
telefon
ehir
fax
posta--kodu
posta
120
20
White Space
XM
ML
XM
ML
Attributes
Elements can contain attributes to provide information
about the element
Attributes are not considered part of an elements content
Attributes are not part of the presentation to an end user,
though they may be used to affect the presentation
pair attached to the element's
An attribute is a name-value p
start-tag
Names are separated from values by an equals sign and
optional whitespace
Values are enclosed in single or double quotation marks
121
XML Names
<person born
born="1912-06-23" died
died="1954-06-07">
Alan Turing
</person>
Attributes (Cont)
XM
ML
XM
ML
or
<person born
born= `1912-06-23` died
died= `1954-06-07`>
Alan Turing
</person>
122
125
<person>
<name first="Alan" last="Turing"/>
<profession value="computer scientist"/>
<profession value="mathematician"/>
<profession value
value="cryptographer"/>
cryptographer />
</person>
XM
ML
3
XM
ML
Attributes (Cont)
124
123
XML names may only start with letters, ideograms, and the
underscore character.
They may not start with a number, hyphen, or period.
There is no limit to the length of an element or other XML name.
Thus these are all well-formed elements:
<Drivers_License_Number>98
<Drivers License Number>98 NY 32
</Drivers_License_Number>
<month-day-year>7/23/2001</month-day-year>
<first_name>Alan</first_name>
<_4-lane>I-610</_4-lane>
<tlphone>011 33 91 55 27 55 27</tlphone>
126
21
XM
ML
127
130
Entity References
CDATA Sections
<forbidenNames>
<A;name/>
<last@name>
<@#$%^()%+?=/>
<A*2/>
<1ex/>
</forbidenNames>
XM
ML
<permitedNames>
<name/>
<xsl:copy-of>
<A_long_element_name/>
<A.name.separated.with.full.stops/>
<a123323123 231 231/>
<a123323123-231-231/>
<_12/>
</permitedNames>
Character References
XM
ML
XM
ML
128
>
& t
3
XM
ML
&
131
XM
ML
"
The straight, double quotation marks (")
'
129
132
22
XM
ML
133
Processing Instructions
134
Encoding
$i = 0;
XM
ML
XM
ML
137
<?php
136
XM
ML
<!-<!
-- I need to verify and update these links when I get a chance. --->
>
Comments
XM
ML
3
XM
ML
Comments
$fields = mysql_fetch_row($result);
mysql fetch row($result);
echo "<person>$fields[1] $fields[0] </person>\r\n";
$i++;
}
mysql_close( );
?>
BTE550 Internet and Intranet Applications
135
138
23
Encoding (Cont)
XM
ML
XM
ML
<?xmlversion="1.0" encoding="ISO
encoding="ISO--88598859-1" standalone="yes"?>
Erwin Schrdinger
</person>
139
140
143
141
<name>Binnur Kurt</name>
XM
ML
3
XM
ML
Well-Formedness
142
XM
ML
XM
ML
Standalone
<name>
<first>Binnur</first>
<last>Kurt</last>
</name>
144
24
XML Quiz 1
Each element has either the end tag or takes the special
form.
There is no difference between <AAA></AAA> and
<AAA/> in XML.
<listOfTags>
<AAA></AAA>
<BBB></BBB>
<CCC/>
<DDD/>
</listOfTags>
XM
ML
XM
ML
145
Solution:
<root>
<e1 a*b = "23432"/>
<e2 value = "12'/>
<e3 value
value="aa"aa"/>
aa aa />
<e4 value='bbbb'/>
<e5 xml-ID = "xml2"/>
</root>
XML Quiz 2
XM
ML
XM
ML
</elements-with-attributes>
146
Find Errors:
<root>
<example>
<![CDATA[ <P>Q&R]]>
</example>
<Name>
Binnur Kurt
</Name>
<Address/>
</root>
XML Quiz 2
Solution:
No error
3
Find errors:
<root>
<e1 a*b = "23432"/>
<e2 value = "12'/>
<e3 value
value="aa"aa"/>
aa aa />
<e4 value=bbbb/>
<e5 xml-ID = "xml2"/>
</root>
XM
ML
3
XM
ML
149
XML Quiz 1
148
147
150
25
XM
ML
XML Quiz 3
Find Errors:
<root>
<isLower>
23 < 46
</isLower>
<Name>
Willey & Sons
</name>
</root>
151
Content
Solution:
<root>
<isLower>
23 < 46
</isLower>
<Name>
Willey & Sons
</name>
</root>
XM
ML
XML Quiz 3
152
Objectives
4
XM
ML
155
153
156
26
157
<?xml version="1.0"?>
<trade account=1234567 action=buy>
<symbol>SUNW</symbol>
<symbol>IBM</symbol>
<symbol>CSCO</symbol>
<quantity>200</quantity>
<quantity>100</quantity>
</trade>
158
161
159
4
XML USING DTDs
160
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>J. Canny</to>
<from>Binnur Kurt</from>
<heading>Tebrikler</heading>
<body>Merhaba!!</body>
</note>
BTE550 Internet and Intranet Applications
162
27
163
name.dtd:
<!ELEMENT name (first
first, last
last)>
<!ELEMENT first (#PCDATA)>
<!ELEMENT last (#PCDATA)>
Employees.xml:
<!DOCTYPE name SYSTEM name.dtd">
<name
name>
<first
first>Sridhar</first
first>
<last
last>Reddy</last
last>
</name
name>
164
167
<?xml version="1.0"?>
<!DOCTYPE trade [
<!ELEMENT trade (symbol, quantity)>
<!ATTLIST trade
account CDATA #REQUIRED
action (buy | sell) #REQUIRED >
<!ELEMENT symbol (#PCDATA)>
<!ELEMENT quantity (#PCDATA)> ]>
<trade account=1234567 action=buy>
<symbol>SUNW</symbol>
<quantity>100</quantity>
</trade>
4
XML USING DTDs
<?xml version="1.0"?>
<!DOCTYPE trade [
<!ELEMENT trade (symbol, quantity)>
<!ATTLIST trade
account CDATA #REQUIRED
action (buy | sell) #REQUIRED >
<!ELEMENT symbol (#PCDATA)>
<!ELEMENT quantity (#PCDATA)> ]>
<trade account=1234567 action=sell>
<symbol>SUNW</symbol>
<quantity>100</quantity>
</trade>
BTE550 Internet and Intranet Applications
166
Example
<?xml version="1.0"?>
<!DOCTYPE trade [
<!ELEMENT trade (symbol, quantity)>
<!ATTLIST trade
account CDATA #REQUIRED
action (buy | sell) #REQUIRED >
<!ELEMENT symbol (#PCDATA)>
<!ELEMENT quantity (#PCDATA)> ]>
<trade account=1234567 action=steal>
<symbol>SUNW</symbol>
<quantity>100</quantity>
</trade>
165
<?xml version="1.0"?>
<!DOCTYPE trade [
<!ELEMENT trade (symbol, quantity)>
<!ATTLIST trade
account CDATA #REQUIRED
action (buy | sell) #REQUIRED >
<!ELEMENT symbol (#PCDATA)>
<!ELEMENT quantity (#PCDATA)> ]>
<trade account=1234567 action=sell>
<symbol>SUNW</symbol>
<quantity>100</quantity>
<quantity>300</quantity>
</trade>
BTE550 Internet and Intranet Applications
168
28
Qualifier
?
*
+
none
Name
Question Mark
Asterisk
Plus Sign
Default
169
4
XML USING DTDs
170
173
tutorial.dtd:
<!ELEMENT XXX (AAA? , BBB+)>
<!ELEMENT AAA (CCC? , DDD*)>
<!ELEMENT BBB (CCC , DDD)>
<!ELEMENT CCC (#PCDATA)>
<!ELEMENT DDD (#PCDATA)>
<!DOCTYPE tutorial SYSTEM "tutorial.dtd">
<XXX>
<AAA>
<CCC/><DDD/>
</AAA>
<BBB>
<CCC/><DDD/>
</BBB>
</XXX>
tutorial.dtd:
<!ELEMENT XXX (AAA? , BBB+)>
<!ELEMENT AAA (CCC? , DDD*)>
<!ELEMENT BBB (CCC , DDD)>
<!ELEMENT CCC (#PCDATA)>
<!ELEMENT DDD (#PCDATA)>
<!DOCTYPE tutorial SYSTEM "tutorial.dtd">
<XXX>
<BBB>
<CCC/>
<DDD/>
</BBB>
</XXX>
BTE550 Internet and Intranet Applications
172
tutorial.dtd:
<!ELEMENT XXX (AAA? , BBB+)>
<!ELEMENT AAA (CCC? , DDD*)>
<!ELEMENT BBB (CCC , DDD)>
<!ELEMENT CCC (#PCDATA)>
<!ELEMENT
!ELEMENT DDD (#PCDATA)>
(#PCDATA)
The root element XXX can contain one element AAA
followed by one or more elements BBB.
Element AAA can contain one element CCC and several
elements DDD.
Element BBB must contain precisely one element CCC
and one element DDD.
tutorial.dtd:
<!ELEMENT XXX (AAA? , BBB+)>
<!ELEMENT AAA (CCC? , DDD*)>
<!ELEMENT BBB (CCC , DDD)>
<!ELEMENT CCC (#PCDATA)>
<!ELEMENT DDD (#PCDATA)>
171
tutorial.dtd:
<!ELEMENT XXX (AAA? , BBB+)>
<!ELEMENT AAA (CCC? , DDD*)>
<!ELEMENT BBB (CCC , DDD)>
<!ELEMENT CCC (#PCDATA)>
<!ELEMENT DDD (#PCDATA)>
<!DOCTYPE tutorial SYSTEM "tutorial.dtd">
<XXX>
<AAA>
<CCC/> <CCC/>
<DDD/> <DDD/>
</AAA>
<BBB>
<CCC/><DDD/>
</BBB>
</XXX>
BTE550 Internet and Intranet Applications
174
29
178
DTD Rules
<!DOCTYPE student [
<!ELEMENT student (name)>
<!ELEMENT name (#PCDATA)>
<!ATTLIST student DOB
CADAT #REQUIRED EDU
CDATA #IMPLIED> ]>
<student DOB="Nov11,1990" EDU="4thGrade">
<name>Curran Reddy </name>
</student>
<student EDU="1st Grade" DOB="May14,1994">
<name>Kaavya Reddy</name>
</student>
176
177
179
180
30
4
XML USING DTDs
181
182
DTD Validation
185
184
183
Also consideration can be based on how you would like to parse the
data.
<employee>
<id> 12056 </id>
<grade>Manager</grade>
g
g
<division>Engineering</division>
<description>
He is a manager of X product. Leads a team of 15
programmers. Also this person is in the special task
force team to build next generation app.
</description>
</employee>
BTE550 Internet and Intranet Applications
186
31
188
189
191
XML.ORG Registry
4
XML Schema
4
190
Limitations of DTDs
or as:
<employee grade=Manager id=12056
division=Engineering >
<description>
He is a manager generation app
</description>
</employee>
192
32
Part 1:
Create a DTD for the XML document that captured the
information about business card in lab 1.
Part 2:
Compare
p yyour DTD to the pperson sittingg next to yyou
and see if you can combine into one which can still
validate both the XML documents.
Atomic types
193
194
197
Complex types
</xs:simpleType>
XML Schema
196
195
198
33
Example
Inheritance Restriction
Supertype: restricting/removing certain fields of an existing
type
4
<xs:complexType name=publicationType>
<xs:sequence>
<xs:choice>
<xs:group ref=journalType>
<xs:element name
name=conference
conference type
type=xs:string/>
xs:string />
</xs:choice>
<xs:element name=title type=xs:string/>
<xs:element name=author type=xs:string
minOccur=0 maxOccur=unbounded/>
</xs:sequence>
</xs:complexType>
BTE550 Internet and Intranet Applications
199
<xs:complexType name=anotherPublicationType>
<xs:complexContent>
<xs:restriction base=publicationType>
<xs:sequence>
<xs:choice>
<xs:group ref=journalType>
<xs:element name=conference type=xs:string/>
</xs:choice>
<xs:element name=author type=xs:string
minOccur=1
maxOccur=unbounded/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
Removed title; minOccur of author is incremented to 1
</xs:complexType>
202
Example (contd)
<xs:group name=journalType>
<xs:sequence>
<xs:element name=name type=xs:string/>
<xs:element name=volume type=xs:integer/>
<xs:element name=number
type=xs:integer/>
</xs:sequence>
</xs:group>
200
HTML
Content
<xs:complexContent>
<xs:extension base=publicationType>
<
<xs:sequence>
>
<xs:element name=isbn type=xs:string/>
</xs:sequence>
<xs:attribute name=publicationDate type=xs:date/>
</xs:extension>
</xs:complexContent>
HTM
ML
Inheritance -- Extension
</xs:complexType>
BTE550 Internet and Intranet Applications
201
204
34
Web-Authoring Tools
HTM
ML
HTM
ML
Overview
Hypertext Markup Language (HTML) is the foundation of all Web
documents, or pages.
This module will teach you the basic elements and architecture of
a web page and how HTML brings it together.
You will learn to identify tags, view code, create hierarchies,
format text and pages, and use styles and style sheets.
205
HTM
ML
206
209
Basics
Edit Views
HTM
ML
HTM
ML
Browsers
HTM
ML
Introduction
208
207
210
35
HTM
ML
211
Standard Views
HTM
ML
BTE550 Internet and Intranet Applications
212
213
HTM
ML
Elements
215
Text Limitations
HTM
ML
214
HTM
ML
View Testing
5
HTM
ML
Browser Limitations
216
36
Uppercase or Lowercase
You can create a tag in either uppercase or lowercase.
For example, the two tags <H1> and <h1> are equivalent
to a browser.
5
HTM
ML
HTM
ML
Tag Architecture
217
HTML tag
The <HTML> tag declares that the text that follows
defines an HTML Web page that can be viewed in a Web
browser.
The closing </HTML> tag ends the page.
HTM
ML
HTM
ML
Browsers
218
HEAD tag
The <HEAD> tag defines the header area of a page, which
is not displayed within the page itself in the browser.
The closing </HEAD> tag ends the header area.
5
HTM
ML
5
HTM
ML
221
Attributes
220
219
222
37
Comment tag
HTM
ML
HTM
ML
TITLE tag
223
Spaces
HTM
ML
HTM
ML
BODY tag
224
Hard Return
225
HTML code ignores all hard returns within the code: for
example, an Enter at the end of a text line you are editing
in Notepad will not be displayed in the user's browser.
5
HTM
ML
5
HTM
ML
227
Paragraph tag
226
228
38
Save as View
To view a page's code, click View > Source in Internet
Explorer or View > Page Source in Navigator to display
the current page's HTML code within Notepad.
5
HTM
ML
HTM
ML
Preformatted tag
229
Information
Evolving Language
5
HTM
ML
HTM
ML
230
Underlying Code
233
5
HTM
ML
HTM
ML
232
231
234
39
Structure Separations
If your page has a banner across the top with a company name, you
can insert a horizontal line beneath it.
This separates it from the table of contents showing links to pages,
beneath which you can insert another line, followed by the main
body of the page.
At the bottom of the page, you can have another line that shows
i
important
page identifiers.
id ifi
HTM
ML
5
HTM
ML
Adding Structure
235
5
HTM
ML
You may not want extra space between each line of the
address.
To avoid this, use the line-break tag, <BR>.
This break tells the browser to wrap the text that follows
onto a new line without inserting any extra space between
the lines.
236
239
Section Divisions
Creating Headings
237
5
HTM
ML
HR tag
HTM
ML
HTM
ML
238
240
40
Comments in HTML
HTM
ML
HTM
ML
Heading Formats
In a browser, a first-level heading is displayed in a larger, bolder
font than a lower-level heading.
You can use HTML headings in any order, but it is recommended to
use them in an outline format.
The first-level heading, <H1>, is the highest level, and the sixth
level, <H6>, is the lowest or most subordinate.
241
Paragraphs
<em>
<strong>
<sub>
<sup>
<ins>
<del>
<s>
<strike>
<u>
245
The <br> tag is used when you want to end a line, but
don't want to start a new paragraph.
The <br> tag forces a line break wherever you place it.
<p>This <br> is a para<br>graph with
line breaks</p>
HTM
ML
5
HTM
ML
<big>
<small>
Line Breaks
Description
<i>
242
Tag
<b>
HTM
ML
HTM
ML
244
243
Tag
<code>
<kbd>
<samp>
<tt>
<var>
<pre>
<listing>
<plaintext>
<xmp>
Description
Defines computer code text
Defines keyboard text
Defines sample computer code
Defines teletype text
Defines a variable
Defines preformatted text
Deprecated. Use <pre> instead
Deprecated. Use <pre> instead
Deprecated. Use <pre> instead
246
41
Description
Defines an abbreviation
Defines an acronym
Defines an address element
D fi
Defines
the
h text direction
di i
Defines a long quotation
Defines a short quotation
Defines a citation
Defines a definition term
Tag
<abbr>
<acronym>
<address>
<bdo>
bd
<blockquote>
<q>
<cite>
<dfn>
HTM
ML
HTM
ML
247
5
HTM
ML
HTM
ML
248
<
 
<
>
&
greater than
ampersand
>
&
>
&
"
quotation mark
"
"
'
apostrophe
'
'
250
Result
Description
cent
pound
yen
section
copyright
registered trademark
£
¥
§
©
®
£
¥
§
©
®
multiplication
division
×
÷
×
÷
251
249
HTM
ML
Entity Number
<
Non-breaking Space
HTM
ML
Entity Name
Some characters have a special meaning in HTML, like the less than
sign (<) that defines the start of an HTML tag.
If we want the browser to actually display these characters we must
insert character entities in the HTML source.
A character entity has three parts: an ampersand (&), an entity name
or a # and an entity number, and finally a semicolon (;).
To display a less than sign in an HTML document we must write:
< or <
The advantage of using a name instead of a number is that a name is
easier to remember.
The disadvantage is that not all browsers support the newest entity
names, while the support for entity numbers is very good in almost
all browsers.
Description
non-breaking space
less than
Character Entities
Result
252
42
With the target attribute, you can define where the linked
document will be opened.
The line below will open the document in a new browser
window:
HTM
ML
Frames
HTM
ML
</a>
253
257
HTM
ML
5
HTM
ML
The <frameset
frameset> tag defines how to divide the window
into frames
Each frameset defines a set of rows or columns
The values of the rows/columns indicate the amount of
screen area each row/column will occupy
256
HTM
ML
HTM
ML
255
258
43
Example
5
HTM
ML
HTM
ML
Vertical frameset
<html>
<frameset cols="25%,50%,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>
/
</html>
259
5
260
<table border=5">
<tr>
<td>Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>
263
Headings in a Table
261
HTM
ML
5
HTM
ML
Tables
262
HTM
ML
HTM
ML
Horizontal frameset
<html>
<frameset rows="25%,50%,25%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
<frame src="frame_c.htm">
</frameset>
/
</html>
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
<table border="1">
<tr>
<th>Heading</th>
<th>Another Heading</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
BTE550 Internet and Intranet Applications
264
44
Ordered Lists
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1,
, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td></td>
</tr>
</table>
HTM
ML
HTM
ML
265
Table Tags
<col>
<thead>
<tbody>
<tfoot>
Description
Defines a table
Defines a table header
Defines a table row
Defines a table cell
D fi
Defines
a ttable
bl caption
ti
Defines groups of table columns
<th>
<tr>
<td>
< ti >
<caption>
<colgroup>
Definition Lists
HTM
ML
HTM
ML
Tag
<table>
266
List Tags
HTM
ML
5
HTM
ML
269
Unordered Lists
268
Tag
<ol>
<ul>
<li>
<dl>
<dt>
<dd>
<dir>
<menu>
Description
Defines an ordered list
Defines an unordered list
Defines a list item
Defines a definition list
Defines a definition term
Defines a definition description
Deprecated. Use <ul> instead
Deprecated. Use <ul> instead
270
45
5
<form
form name="input" action="html_form_action.asp" method="get">
HTM
ML
HTM
ML
AppleScript
ASP
ColdFusion
C/C++
- PHP
- TCL
- the Unix shell
- Visual Basic
<input
input type="text
text" name
name="LastName" value="Kurt" size="20">
<br>
<input
input type="submit
submit" value
value="Submit
Submit">
</form
form>
BTE550 Internet and Intranet Applications
271
HTM
ML
272
275
HTM
ML
HTM
ML
Input boxes
Selection lists
Drop-down list boxes
Option buttons or radio buttons
Check boxes
Group boxes
Text areas
Form buttons
HTM
ML
274
273
276
46
Example:
HTM
ML
HTM
ML
id=id> </form>
<form name=name
<form name=reg
name= reg id=
id=reg>
reg >
</form>
277
HTM
ML
<i
<input
t t
type=text
t t name=city
it id
id=city
it />
HTM
ML
278
type=image
type=radio
type=reset
type=submit
type=text
check box
type=hidden
type=password
type=file
281
HTM
ML
HTM
ML
type=checkbox
280
Type
279
282
47
HTM
ML
HTM
ML
A selection list
283
<form id=reg>
<select name=item id=item>
<option> dogs </option>
<option> cats </option>
<option> mice </option>
</select>
</form>
284
5
HTM
ML
5
HTM
ML
285
287
HTM
ML
HTM
ML
Select list
286
<select attributes>
<optgroup label=label1>
<option>itema1</option>
<option>itema2</option>
</optgroup>
</select>
BTE550 Internet and Intranet Applications
288
48
HTM
ML
HTM
ML
289
HTM
ML
HTM
ML
290
Command button
Submit button
Reset button
File button
293
HTM
ML
HTM
ML
292
291
294
49
5
HTM
ML
HTM
ML
295
HTM
ML
HTM
ML
298
296
</form>
HTM
ML
HTM
ML
where url specifies the filename and location of the program that
processes
the form and the method attribute specifies how your Web
browser sends data to the server.
The enctype attribute specifies the format of the data stored in
the forms field.
BTE550 Internet and Intranet Applications
299
297
300
50
An access key
single key typed with the Alt key
in order to jump to one of the control elements in the
form.
Create an access key by adding the accesskey attribute to
any control
t l element.
l
t
Example of creating an access key for the lname field:
<input name=lname accesskey=1 />
HTM
ML
HTM
ML
301
<option>
<button>
<label>
<fieldset>
<legend>
<select>
<optgroup>
The <body> tag has two attributes where you can specify
backgrounds. The background can be a color or an image.
The bgcolor attribute specifies a background-color for an
HTML page.
The value of this attribute can be a hexadecimal number,
an RGB value, or a color name
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
The lines above all set the background-color to black
302
Background
HTM
ML
5
HTM
ML
305
304
Backgrounds
HTM
ML
5
HTM
ML
Description
Defines a form for user input
Defines an input field
Defines a text-area (a multi-line text input control)
Form Tags
Tag
<form>
<input>
<textarea>
306
51
HTM
ML
5
HTM
ML
Useful Tips
307
Color Values
Red
rgb(0,0,0)
rgb(8,0,0)
rgb(16,0,0)
HTM
ML
HTM
ML
310
rgb(255,0,0)
BTE550 Internet and Intranet Applications
308
311
HTM
ML
Color Names
A collection of color names is supported by most
browsers.
Only 16 color names are supported by the W3C HTML
4.0 standard (aqua, black, blue, fuchsia, gray, green, lime,
maroon, navy, olive, purple, red, silver, teal, white, and
yellow).
ll )
For all other colors you should use the Color HEX value.
309
XHTML
52
Introduction to XHTML
Why XHTML
XHTML vs HTML
XHTML Syntax
XHTML DTD
XHTML Modules
XHTML Attributes
XHTM
ML 6
Content
313
Why XHTML?
XHTM
ML 6
XHTM
ML 6
What is XHTML?
314
317
Why XHTML?
315
XHTM
ML 6
XHTM
ML 6
316
318
53
Quiz
XHTM
ML 6
XHTM
ML 6
319
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
<li>Milk</li>
</ul>
XHTM
ML 6
Answer
XHTM
ML 6
320
<ul>
<li>Coffee</li>
<li
li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li
li>
<li>Milk</li>
</ul>
BTE550 Internet and Intranet Applications
323
321
XHTM
ML 6
XHTM
ML 6
322
324
54
XHTM
ML 6
XHTM
ML 6
325
XHTM
ML 6
XHTM
ML 6
326
329
XHTM
ML 6
XHTM
ML 6
328
This is correct:
This is wrong:
<table WIDTH
WIDTH="100%">
This is correct:
<table width="100%">
This is a break<br/>
Here comes a horizontal rule:<hr/>
Here's an image <img src="happy.gif" alt="Happy face"/>
327
330
55
This is wrong:
<table width=100%
100%>
This is correct:
<table width="
"100%"
">
XHTM
ML 6
XHTM
ML 6
331
This is wrong:
<input checked
checked>
<input readonly>
<input disabled>
<option selected>
frame noresize
noresize>
<frame
This is correct:
<input checked="checked"
"checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />
XHTM
ML 6
XHTM
ML 6
332
compact
compact="compact"
checked
checked="checked"
declare
declare="declare"
readonly
readonly="readonly"
disabled
disabled="disabled"
selected
selected="selected"
selected=
selected
defer
defer="defer"
ismap
ismap="ismap"
nohref
nohref="nohref"
noshade
noshade="noshade"
nowrap
nowrap="nowrap"
multiple
multiple="multiple"
noresize
noresize="noresize"
335
XHTML
XHTM
ML 6
XHTM
ML 6
334
333
336
56
An XHTML Example
XHTM
ML 6
XHTM
ML 6
337
338
341
XHTM
ML 6
XHTM
ML 6
An XHTML Example
340
XHTM
ML 6
XHTM
ML 6
339
342
57
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1
xhtml1--strict.dtd">
strict.dtd
Use this when you want really clean markup, free of
presentational clutter.
p
Use this together with Cascading Style Sheets.
XHTM
ML 6
XHTM
ML 6
343
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1
xhtml1-transitional.dtd">
transitional.dtd
Use this
when you need to take advantage of HTML's
presentational features
when you want to support browsers that don't
understand Cascading Style Sheets.
XHTM
ML 6
XHTM
ML 6
344
XHTML Modules
345
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1
xhtml1--frameset.dtd">
frameset.dtd
Use this when you want to use HTML Frames to partition
the browser window into two or more frames.
XHTM
ML 6
XHTM
ML 6
347
346
Module name
Description
Applet Module
Base Module
Bi-directional
Bi
directional Text Module
Edit Module
Forms Module
Frames Module
Hypertext Module
Iframe Module
Image Module
348
58
Legacy Module
Link Module
List Module
Defines the list elements ol, li, ul, dd, dt, and dl.
Metainformation Module
Object Module
Presentation Module
Scripting Module
Structure Module
Tables Module
Target Module
Text Module
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param,
and script elements.
XHTM
ML 6
XHTM
ML 6
Image Module
349
Attribute
dir
lang
XHTM
ML 6
XHTM
ML 6
350
Attribute
Value
accesskey
character
tabindex
number
Description
Sets a keyboard shortcut to access
an element
Sets the tab order of an element
Core Attributes
353
XHTM
ML 6
352
Keyboard Attributes
Attribute
Value
Description
class
class_rule or style_rule
id
id_name
style
style_definition
title
tooltip_text
Description
Sets the text direction
Sets the language code
Value
ltr | rtl
language_code
351
We
will
ill learn
l
more about
b
programming
i with
i h these
h
events
in studying JavaScript and DHTML.
354
59
Window Events
Mouse Events
XHTM
ML 6
Value
Description
onload
script
onunload
script
XHTM
ML 6
Not valid in base, bdo, br, frame, frameset, head, html, iframe,
meta, param, script, style, and title elements.
Attribute
Value
onclick
ondblclick
355
Description
Attribute
Value
Description
onchange
onsubmit
script
script
onreset
script
S i to be
Script
b run when
h the
h form
f
iis reset
onselect
onblur
script
script
onfocus
script
XHTM
ML 6
XHTM
ML 6
356
Quiz
Keyboard Events
Question # 1
XHTM
ML 6
XHTM
ML 6
Attribute
Value
onkeydown
script
onkeypress
script
onkeyup
script
359
Description
357
a.
b.
c.
d
d.
360
60
Question # 2
Question # 5
XHTM
ML 6
XHTM
ML 6
361
a.
b.
c.
d
d.
Question # 3
Question # 6
XHTM
ML 6
XHTM
ML 6
362
a.
b.
c.
365
Question # 4
Question # 7
XHTM
ML 6
XHTM
ML 6
364
363
366
61
Question # 8
Question # 11
XHTM
ML 6
XHTM
ML 6
367
Question # 9
Question # 12
<ul>
<li>Coffee</li>
<li>Tea
<ul>
li Black tea
tea</li>
/li
<li>Black
<li>Green tea</li>
</ul>
<li>Milk</li>
</ul>
XHTM
ML 6
XHTM
ML 6
370
a. No
b. Yes
BTE550 Internet and Intranet Applications
368
Question # 10
Question # 13
XHTM
ML 6
XHTM
ML 6
371
369
a.
b.
c.
372
62
Question # 17
XHTM
ML 6
XHTM
ML 6
Question # 14
373
a.
b.
c.
Question # 18
374
Question # 16
377
Question # 19
XHTM
ML 6
XHTM
ML 6
376
XHTM
ML 6
XHTM
ML 6
Question # 15
a.
b.
c.
375
a.
b.
c.
d
d.
378
63
Question # 20
XSL
XSLT
LT 7
XHTM
ML 6
379
382
XSLT
XSLT
LT 7
XSLT
383
XSLT (Cont)
XSLT
LT 7
XSLT
LT 7
Content
381
384
64
XSLT
LT 7
XSLT
LT 7
XSLT in POP
385
XSLT
LT 7
Transformation process
XSLT
LT 7
386
389
XSLT
LT 7
XSLT
LT 7
XSLT in MOM
388
387
390
65
XSLT
LT 7
XPath
XSLT
LT 7
391
XPath (Cont)
Piece of software
Reads an XSLT stylesheet and input XML document
Converts the input document into an output document
According to the instruction given in the stylesheet
Called stylesheet processor sometimes
XSLT
LT 7
XSLT
LT 7
XSLT Processor
392
395
XSLT
LT 7
XSLT
LT 7
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
p
yp g p
p
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>M</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>
BTE550 Internet and Intranet Applications
394
393
s1.xml
396
66
XSLT
LT 7
XSLT
LT 7
XSLT Stylesheet
397
XSLT
LT 7
XSLT
LT 7
s1.xsl
398
401
XSLT
LT 7
Apache Xalan
400
java org.apache.xalan.xslt.Process
IN s1.xml XSL s1.xsl OUT s1.html
s1.html
399
<?xml version=1.0?>
<?xml-stylesheet
type=text/xml
href=http://www.oreilly.com/styles/people.xsl?>
<people>
.
BTE550 Internet and Intranet Applications
402
67
Result
XSLT
LT 7
XSLT
LT 7
Templates
403
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
p
</xsl:template>
</xsl:stylesheet>
XSLT
LT 7
XSLT
LT 7
404
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match=people">
Hello World!
</xsl:template>
</xsl:stylesheet>
407
Result
<people>
XSLT
LT 7
XSLT
LT 7
406
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>M</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>
BTE550 Internet and Intranet Applications
405
408
68
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
A Person
</xsl:template>
</xsl:stylesheet>
Literal data characters - text copied from the stylesheet into
the output document
XSLT
LT 7
XSLT
LT 7
409
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
A Person
</xsl:template>
</xsl:stylesheet>
Same stylesheet with example 3 but with different input
XML document
XSLT
LT 7
XSLT
LT 7
<people
people>
<person
person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person
person born="1918" died="1988">
...
</person>
Some text here under people element!
<some-tag>
some information inside some-tag
</some-tag>
</people>
Result
<?xml version="1.0" encoding="UTF-8"?>
XSLT
LT 7
413
Result
412
411
A Person
Template content
A Person
Template
p
content
default
default
414
69
Example Stylesheet
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
<p>A
<p>
A Person </p>
</xsl:template>
</xsl:stylesheet>
Literal data characters - text copied from the stylesheet into
the output document
XSLT
LT 7
XSLT
LT 7
415
Result
XSLT
LT 7
XSLT
LT 7
416
<people>
<person born="1912" died="1954">
<name>
<first_name>Alan
Alan</first_name>
<last_name>Turing
Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard
Richard</first_name>
<middle_initial>M
M</middle_initial>
<last_name>Feynman
Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>
Result
417
XSLT
LT 7
XSLT
LT 7
419
xsl:value--of Element
xsl:value
418
<p>
Alan
Turing
</p>
<p>
Richard
M
Feynman
</p>
BTE550 Internet and Intranet Applications
420
70
xsl:apply-templates Example
XSLT
LT 7
XSLT
LT 7
xsl:apply-templates
421
XSLT
LT 7
XSLT
LT 7
xsl:apply-templates Example
422
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="name">
<xsl:value-of
<xsl:value
of select
select="last
last_name
name"/>
/>,
<xsl:value-of select="first_name"/>
</xsl:template>
<!-<!
-- Something is missing here --->
>
</xsl:stylesheet>
Result
xsl:apply
xsl:apply--templates lets you make your choice of
processing order explicit
select attribute contains XPath expression telling the
XSLT processor which nodes to process in the input tree
The apply-templates with no select attribute means all
elements relative to the current element (context node)
should be matched
423
XSLT
LT 7
XSLT
LT 7
425
xsl:apply-templates (Cont)
424
xsl:apply-templates (Cont)
426
71
xsl:apply-templates
XSLT
LT 7
XSLT
LT 7
xsl:apply-templates Example
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="name">
<xsl:value-of select="last_name"/>,
<xsl:value-of
<xsl:value
of select="first
select first_name
name"/>
/>
</xsl:template>
<!-- Apply templates only to name children -->
<xsl:template match="person">
<xsl:apply-templates select="name"/>
</xsl:template>
</xsl:stylesheet>
427
xsl:apply-templates (Cont)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Apply templates only to name children -->
<xsl:template match="person">
<xsl:apply-templates select="name"/>
</xsl:template>
<xsl:template match="name">
<xsl:value-of select="last_name"/>,
<xsl:value-of select="first_name"/>
</xsl:template>
</xsl:stylesheet>
XSLT
LT 7
XSLT
LT 7
428
Example
Alan
Turing
XSLT
LT 7
XSLT
LT 7
431
Result
Richard
M
Feynman
BTE550 Internet and Intranet Applications
430
xsl:apply-templates Example
429
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<html>
<head><title>Famous Scientists</title></head>
<body> <xsl:apply-templates/> </body>
</html>
</xsl:template>
<xsl:template match="person">
<xsl:apply-templates select="name"/>
</xsl:template>
<xsl:template match="name">
<p><xsl:value-of select="last_name"/>,
<xsl:value-of select="first_name"/></p>
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
432
72
Result
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF8">
<title>Famous Scientists</title>
</head>
<body>
<p>Alan</p>
<p>Turing</p>
<p>Richard</p>
<p>Feynman</p>
</body>
</html>
XSLT
LT 7
XSLT
LT 7
Result
433
<html>
<head>
<META http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title>Famous Scientists</title>
</head>
<body>
<dl>
<dt>
Alan
Turing
</dt>
<dd>
<ul>
<li>Born: 1912</li>
<li>Died: 1954</li>
</ul>
</dd>
XSLT
LT 7
XSLT
LT 7
436
Modes
434
Attributes
437
XSLT
LT 7
XSLT
LT 7
</dl>
</body>
</html>
Attributes
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<html>
<head><title>Famous Scientists</title></head>
<body>
<dl>
<xsl:apply-templates/>
</dl>
</body>
/b d
</html>
</xsl:template>
<xsl:template match="person">
<dt><xsl:apply-templates select="name"/></dt>
<dd><ul>
<li>Born: <xsl:apply-templates select="@born"/></li>
<li>Died: <xsl:apply-templates select="@died"/></li>
</ul></dd>
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
<dt>
Richard
M
Feynman
</dt>
<dd>
<ul>
<li>Born: 1918</li>
<li>Died: 1988</li>
</ul>
</dd>
435
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<html>
<head><title>Famous Scientists</title></head>
<body>
<ul><xsl:apply-templates select="person" mode="toc"/></ul>
<xsl:apply-templates select="person"/>
</body>
</html>
</xsl:template>
<!-- Table of Contents Mode Templates -->
<xsl:template match="person" mode="toc">
<xsl:apply-templates select="name" mode="toc"/>
</xsl:template>
<xsl:template match="name" mode="toc">
<li><xsl:value-of select="last_name"/>,
<xsl:value-of select="first_name"/></li>
</xsl:template>
<!-- Normal Mode Templates -->
<xsl:template match="person">
<p><xsl:apply-templates/></p>
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
438
73
Result
Alan
Turing
computer scientist
mathematician
cryptographer
</p>
<p>
XSLT
LT 7
XSLT
LT 7
Result
<html>
<head>
<META http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Famous Scientists</title>
</head>
<body>
<ul>
<li>Turing,
Alan</li>
<li>Feynman,
Richard</li>
</ul>
<p>
Richard
M
Feynman
Richard
M
Feynman
physicist
physicist
Playing the bongoes
</p>
</body>
</html>
439
Alan
Turing
computer scientistmathematiciancryptographer
xsl:for-each
XSLT
LT 7
Filtering
440
443
Example of xsl:for-each
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
<xsl:apply-templates
<xsl:apply
templates select
select="*[not
[not
not(self::hobby)]"/>
not(self::hobby)]
/>
</xsl:template>
</xsl:stylesheet>
The self keyword is needed to inform the XSLT processor
that the node following is a child of the current one
441
XSLT
LT 7
XSLT
LT 7
Filtering Example
442
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<xsl:for
for--each select
select="person">
person >
<xsl:value-of select="name"/>
<xsl:value-of select="@born"/>
</xsl:for
for--each>
each
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
444
74
Result
Result
<?xml version="1.0" encoding="UTF-8"?>
Alan
Turing
Alan
Turing
1912
Richard
M
Feynman
1918
XSLT
LT 7
XSLT
LT 7
445
xsl:if
XSLT
LT 7
XSLT
LT 7
446
449
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<xsl:for-each select="person">
<xsl:value-of select="name"/>
XSLT
LT 7
XSLT
LT 7
Example of xsl:if
<xsl:if test="@born='1912'">
Died in <xsl:value-of select="@died"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
448
Died in
1954
Richard
M
Feynman
447
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<xsl:for-each select="person">
<xsl:value-of select="name"/>
<xsl:choose>
@
<xsl:when test="@born='1912'">
Died in <xsl:value-of select="@died"/>
</xsl:when>
<xsl:otherwise>
Did not die in 1912
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
BTE550 Internet and Intranet Applications
450
75
Result
Result
<?xml version="1.0" encoding="UTF-8"?>
Alan
Turing
Alan
Turing
Died in 1954
XSLT
LT 7
XSLT
LT 7
Richard
M
Feynman
Richard
M
Feynman
Did not die in 1912
physicist
Playing the bongoes
451
XSLT
LT 7
XSLT
LT 7
452
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<xsl:apply-templates>
<xsl:apply
templates>
<xsl:sort select="name order="descending />
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
Result
<?xml version="1.0" encoding="UTF-8"?>
Richard
M
Feynman
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="people">
<xsl:apply-templates>
<xsl:apply
templates>
<xsl:sort select="name"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
XSLT
LT 7
XSLT
LT 7
455
454
xsl:sort
computer scientist
mathematician
cryptographer
physicist
Playing the bongoes
Alan
Turing
computer scientist
mathematician
cryptographer
453
456
76
xsl:copy: Example # 2
XSLT
LT 7
XSLT
LT 7
xsl:copy
457
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match=*">
< l
<xsl:copy>
>
<xsl:apply-templates>
<xsl:sort select="name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Result
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match=people">
< l
<xsl:copy>
>
<xsl:apply-templates>
<xsl:sort select="name"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
XSLT
LT 7
XSLT
LT 7
Example of xsl:copy
458
Result
461
Programming API
XSLT
LT 7
XSLT
LT 7
460
physicist
Playing the bongoes
Alan
Turing
computer scientist
mathematician
cryptographer
BTE550 Internet and Intranet Applications
459
462
77
XSLT
LT 7
463
CSS
Content
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer =
tf.newTransformer(new StreamSource(foo.xsl);
transformer.transform(
new StreamSource(foo.xml),
new StreamSource(bar.xml));
St
S
(b
l))
CSS
S
XSLT
LT 7
464
467
465
What is CSS?
CSS
S
XSLT
LT 7
468
78
CSS
S
CSS
S
8
CSS
S
8
CSS
S
470
CSS
S
473
Cascading Order
CSS
S
472
What style will be used when there is more than one style
specified for an HTML element?
All the styles will "cascade" into a new "virtual" style sheet
by the following rules, where number four has the highest
priority:
1. Browser default
2. External style sheet
3. Internal style sheet (inside the <head> tag)
4. Inline style (inside an HTML element)
Inline style (inside an HTML element) has the highest
priority, which means that it will override a style declared
inside the <head> tag, in an external style sheet, or in a
browser.
BTE550 Internet and Intranet Applications
474
79
CSS
S
CSS
S
475
478
CSS
S
CSS
S
CONTENT
STYLE
Web page
BTE550 Internet and Intranet Applications
476
Status of CSS
CONTENT
STYLE
CSS
S
479
Web page
477
480
80
Types of CSS
8
CSS
S
CSS
S
CSS
External
Embedded
Imported
Inline
481
484
External
8
CSS
Text
Physical layout
CSS
Physical
Layout
CSS
S
CSS
S
Text
CSS
CSS
Headings
Headings
Body
Body
482
Devices
Internal/Embedded
CONTENT
8
CSS
CSS
CSS
CSS
S
CSS
S
BROWSER
CONTENT
485
MOBILE
PDA
PRINT
BTE550 Internet and Intranet Applications
483
486
81
Inserting a CSS
Internal/embedded sheet
CSS
S
CSS
S
Imported
487
<head>
<style type=text/css>
hr { color: navy}
body {margin-left: 20px}
</style>
</head>
Inserting a CSS
CSS
S
Least flexible
Requires each element to be tagged if you want them to
appear differently
Looses the advantage of using CSS
CSS
S
Inline
488
Inserting a CSS
Inline
<head>
<link rel=stylesheet type=text/css
y y
/>
href=mystyle.css
</head>
CSS
S
8
CSS
S
491
Inserting a CSS
External sheet
490
489
492
82
CSS
S
CSS
S
493
8
CSS
S
8
CSS
S
494
Least weight
496
Cascading
Determining rule weight by specificity
Rules with more specific selectors take precedence
over rules with less specific selectors
Determiningg rule weight
g byy order
Based on order of rule within style sheet
Those listed later take precedence over those
listed earlier in the style sheet
497
CSS
S
CSS
S
Greatest weight
Browsers
style sheet
Users
style
sheet
Authors
style
sheet
495
Inheritance
Based on hierarchical structure of documents
CSS rules inherit from parent elements to child
elements:
thus <LI> elements will inherit style
y rules from
<UL> elements unless a style rule is specifically
set for the <LI> element
498
83
CSS
S
CSS
S
499
declaration
500
503
body
CSS
S
CSS
S
502
CSS
S
CSS
S
body {color
color
501
504
84
8
CSS
S
CSS
S
P B { color: yellow }
In this example, only those <B> elements within a <P> element would
b yellow
be
ll
<p><b> This would be yellow </b></p>
<p> This would not be yellow </p>
505
p { text-align: center;
y;
color: navy;
font-family: arial
}
CSS
S
CSS
S
506
h1,h2,h3,h4,h5,h6
{ color: yellow
y
}
CSS
S
509
CSS
S
508
</p>
Note:
the class name must be in quotes inside the opening tag
507
510
85
CSS Syntax - id
CSS
S
CSS
S
511
CSS Syntax - id
You can also create a class selector free of a tag name if you
want all tags that have that class to be formatted the same.
A tag with
Any
i h a center class
l will
ill be
b aligned
li d center
CSS
S
CSS
S
512
515
<h1 class=center>
This heading will be centered
</h1>
CSS
S
<p id=para1>
This text would be centered and green
</p>
CSS
S
514
<p class=center>
So will this text
/* This is a comment */
P { color:
co o : red;
ed;
/* This is another comment */
Font-family: verdana }
</p>
513
516
86
Background properties
CSS
S
CSS
S
517
Background properties
CSS
S
CSS
S
520
518
Basic syntax
background
background-color
background-image
background
background-repeat
repeat
background-attachment
background-position
521
Background properties
Background Properties
CSS
S
CSS
S
519
522
87
Background properties
CSS
S
CSS
S
523
Background properties
8
CSS
S
CSS
S
524
Background properties
CSS
S
body
{ background-image: url(psumark.gif);
background-color:
background
color: navy }
527
Text properties
526
Text properties
CSS
S
Text Properties
525
528
88
color
sets the color of the text
color can be represented by the color name (red), an
rgb value (rgb(255,0,0)), or by a hexadecimal number
(#ff0000)
Syntax
body {color: #ff0000}
Text properties
CSS
S
CSS
S
Text properties
529
532
Text properties
direction
sets the direction of the text
can be set as left to right (ltr) or right to left (rtl)
Syntax
body {direction: rtl}
CSS
S
CSS
S
Text properties
text
text--decoration
adds certain decoration elements to the text
possible values are none, underline, overline, linethrough and blink
y
Syntax
p {text-decoration: underline}
530
text
text--indent
indents the first line of text inside an element
possible values are length (defines a fixed value) and
% (defines a % of the parent element)
y
Syntax
p {text-indent: 20px}
533
text
text--align
aligns the text in an element
possible values are left, right, center and justify
Syntax
p {text-align:
{text align: center}
CSS
S
CSS
S
Text properties
531
Font Properties
534
89
Font properties
Font properties
normal
font displays as is
small-caps
font displays in all capitals,
with lower case letters in
smaller size
font
font--variant
CSS
S
CSS
S
535
Font properties
Font properties
font
font--weight
CSS
S
CSS
S
font-style
font-variant
font-weight
font-size/line-height
font-family
font family
font
538
normal
bold
bolder
lighter
weighted values
536
Font properties
Weighted values
range from 100 900
400 is the same as normal weight
700 is the same as bold weight
CSS
S
CSS
S
normal
italic
oblique
font
font--style
539
537
540
90
Font properties
xx-small to xx-large
smaller
smaller than parent
larger
larger
g than parent
p
%
% of the parent
CSS
S
CSS
S
font
font--size
Border properties
Font properties
Border properties
family-name
times, arial, courier,
verdana
generic-family
serif,, sans-serif,,
monospace
CSS
S
CSS
S
font
font--family
544
542
545
Border Properties
CSS
S
CSS
S
543
Margin Properties
546
91
Margin properties
CSS
S
Margin properties
547
Properties
margin
margin-top
margin-right
margin-bottom
g
margin-left
548
551
Margin properties
auto
set by the browser
length
fixed
%
CSS
S
8
CSS
S
h1 {margin: 40px}
Margin properties
550
Margin properties
CSS
S
CSS
S
Margin properties
margin-bottom
549
552
92
Margin properties
CSS
S
h1 {margin: 40px 0 5% 0}
In this example, the top margin would be 40 pixels, the left and
right margins would be 0, and the bottom margin would
be 5% of the total height of the document.
Multimedia Standards
556
557
Multimedia S
Standards 9
Multimedia S
Standards 9
Content
Multimedia S
Standards 9
553
Multimedia S
Standards 9
555
558
93
JPEG Summary
ISO/IEC
International Organization for Standardization
Deals with information processing, e.g., image storage
and retrieval
ITU
ITU-T
T
International Telecommunication Union
Formerly known as CCITT
Deals with information transmission
Multimedia S
Standards 9
Multimedia S
Standards 9
559
Multimedia S
Standards 9
Multimedia S
Standards 9
560
563
561
Multimedia S
Standards 9
Multimedia S
Standards 9
What Is JPEG?
562
564
94
Multimedia S
Standards 9
Multimedia S
Standards 9
565
Disadvantages
Single resolution
Single quality
No target bit rate
No lossless capability
No tiling
No ROI
Blocking artifacts
Poor error resilience
Multimedia S
Standards 9
Advantages
Memory Efficient
Low complexity
Compression efficiency
Visual model utilization
Robustness
R b t
566
567
569
570
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
568
95
Multimedia S
Standards 9
Multimedia S
Standards 9
574
Multimedia S
Standards 9
Multimedia S
Standards 9
575
Multimedia S
Standards 9
Multimedia S
Standards 9
573
576
96
Multimedia S
Standards 9
Multimedia S
Standards 9
1 bpp, CR=8:1
BTE550 Internet and Intranet Applications
577
580
Multimedia S
Standards 9
Multimedia S
Standards 9
578
581
Preprocessing
The input image is partitioned into rectangular and nonoverlapping tiles of equal size (except possibly for those
tiles at the image borders) that are compressed
independently using their own set of specified compression
parameters.
The unsigned sample values in each component are level
shifted (DC offset) by subtracting a fixed value from each
sample to make its value symmetric around zero.
The level-shifted values can be subjected to a forward
point-wise inter-component transformation to decorrelate
the color data. A restriction is that components must have
identical bit-depths and dimension
579
Multimedia S
Standards 9
Multimedia S
Standards 9
582
97
Multimedia S
Standards 9
Multimedia S
Standards 9
583
586
587
588
Multimedia S
Standards 9
Multimedia S
Standards 9
585
Multimedia S
Standards 9
584
Multimedia S
Standards 9
98
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
590
591
592
593
594
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
589
Multimedia S
Standards 9
99
Multimedia S
Standards 9
Multimedia S
Standards 9
595
598
599
600
Multimedia S
Standards 9
Multimedia S
Standards 9
596
Multimedia S
Standards 9
Multimedia S
Standards 9
1D Two-Band DWT
597
100
Multimedia S
Standards 9
Multimedia S
Standards 9
601
604
Multimedia S
Standards 9
Multimedia S
Standards 9
602
Inverse DWT
605
Multimedia S
Standards 9
Multimedia S
Standards 9
603
606
101
Bi-Orthogonal DWT
Multimedia S
Standards 9
Multimedia S
Standards 9
607
610
Multimedia S
Standards 9
Multimedia S
Standards 9
2D Wavelet Decomposition
608
611
ROI Example
609
Multimedia S
Standards 9
Multimedia S
Standards 9
612
102
Multimedia S
Standards 9
Error Effects
Multimedia S
Standards 9
613
616
Multimedia S
Standards 9
Multimedia S
Standards 9
Error Resilience
614
617
Error-prone Channels
Multimedia S
Standards 9
BER = 10-5
JPEG CR=16:1
615
618
103
Test Images
Multimedia S
Standards 9
Multimedia S
Standards 9
BER = 10-4
JPEG CR=16:1
Multimedia S
Standards 9
Multimedia S
Standards 9
JPEG-LS
622
620
623
624
Multimedia S
Standards 9
Multimedia S
Standards 9
PNG
621
104
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
625
628
Multimedia S
Standards 9
Multimedia S
Standards 9
Non-progressive Results
626
629
630
Multimedia S
Standards 9
Multimedia S
Standards 9
Lossless Results
627
105
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
632
634
635
Multimedia S
Standards 9
631
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
633
636
106
Multimedia S
Standards 9
Multimedia S
Standards 9
637
640
Multimedia S
Standards 9
Multimedia S
Standards 9
638
641
642
Multimedia S
Standards 9
Multimedia S
Standards 9
639
107
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
644
645
646
647
648
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
643
Multimedia S
Standards 9
108
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
650
651
652
653
654
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
649
Multimedia S
Standards 9
109
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
656
657
658
659
660
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
655
Multimedia S
Standards 9
110
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
662
663
664
665
666
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
661
Multimedia S
Standards 9
111
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
668
669
670
671
672
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
667
Multimedia S
Standards 9
112
Multimedia S
Standards 9
Multimedia S
Standards 9
BTE550 Internet and Intranet Applications
674
675
676
677
678
Multimedia S
Standards 9
Multimedia S
Standards 9
Multimedia S
Standards 9
673
Multimedia S
Standards 9
113
Multimedia S
Standards 9
Multimedia S
Standards 9
679
Multimedia S
Standards 9
MPEG-21
Multimedia S
Standards 9
MPEG-4
680
683
MPEG-21 Scope
681
Multimedia S
Standards 9
Multimedia S
Standards 9
MPEG-7
682
684
114
Multimedia S
Standards 9
Multimedia S
Standards 9
685
688
MPEG-21 User
MPEG-21Part 1 Vision
Multimedia S
Standards 9
Multimedia S
Standards 9
686
Multimedia S
Standards 9
Multimedia S
Standards 9
MPEG-21 CE Testbed
689
687
690
115
Multimedia S
Standards 9
Multimedia S
Standards 9
Digital assets
691
Multimedia S
Standards 9
Multimedia S
Standards 9
692
693
695
694
696
116
Multimedia S
Standards 9
Multimedia S
Standards 9
697
701
Multimedia S
Standards 9
Multimedia S
Standards 9
700
Multimedia S
Standards 9
699
702
117
Scope of standardization
Multimedia S
Standards 9
Multimedia S
Standards 9
703
User Characteristics
Terminal Capabilities
Network Characteristics
Natural Environment Characteristics
Resource Adaptability
p
y
Session Mobility
Multimedia S
Standards 9
Multimedia S
Standards 9
706
704
Multimedia S
Standards 9
705
707
708
118
Multimedia S
Standards 9
AdaptationQoS BSD
Multimedia S
Standards 9
Adaptation architecture
709
713
711
Multimedia S
Standards 9
Multimedia S
Standards 9
Metadata Adaptability
712
Multimedia S
Standards 9
Multimedia S
Standards 9
714
119
Multimedia S
Standards 9
Multimedia S
Standards 9
715
Multimedia S
Standards 9
Multimedia S
Standards 9
716
719
Multimedia S
Standards 9
Multimedia S
Standards 9
718
717
720
120
What is JavaScript?
10
JavaScrript
10
Dynamic HTML:
JavaScript
724
10
What is JavaScript?
What can a JavaScript Do?
How to include JavaScript in html?
JavaScript Variables
JavaScript Expressions
Control Statements
DOM and Events
JavaScrript
JavaScrript
10
Content
NO!!
Java and JavaScript are two completely different
languages in both concept and design!
Java (developed by Sun Microsystems) is a powerful and
much more complex programming language - in the same
category as C# and C++.
722
725
723
10
What is JavaScript?
JavaScrript
JavaScrript
10
726
121
10
JavaScrript
JavaScrript
10
727
Simple Example
10
JavaScrript
JavaScrript
10
728
<HTML>
<HEAD>
<TITLE>First JavaScript Example</TITLE>
</HEAD>
<BODY>
<H2>This line is straight HTML</H2>
<H3>
<SCRIPT type = "text/javascript">
document write("These
document.write(
These lines are produced by<br/>");
by<br/> );
document.write("the JavaScript program<br/>");
alert("Hey, JavaScript is fun!");
</SCRIPT>
</H3>
<H2>More straight HTML</H2>
<SCRIPT type = "text/javascript src="bogus.js"></script>
</BODY>
</HTML>
10
JavaScrript
10
JavaScrript
731
JavaScript Variables
730
D l i
Declarations
are made
d using
i the
h var keyword
k
d
732
122
10
JavaScript Expressions
JavaScrript
JavaScrript
10
JavaScript Variables
733
JavaScript Variables
10
JavaScrript
10
JavaScrript
737
Control Statements
10
JavaScrript
10
JavaScrript
Relational operators:
==, !=, <, >, <=, >=
The above allow for type coercion. To prevent
coercion there is also
===,, !==
Similar to PHP
Boolean operators
&&, ||, !
&&, || are short-circuited (as in Java and PHP)
JavaScript Expressions
736
Control Statements
735
738
123
Array Objects
10
No parameter type-checking
Numbers of formal and actual parameters do not have to
correspond
Extra actual parameters are ignored
Extra formal parameters are undefined
All actual parameters can be accessed regardless of formal
parameters by using the arguments array
BTE550 Internet and Intranet Applications
JavaScrript
JavaScrript
10
Functions
Functions execute when they are called, just as in any
language
To allow this, function code should be in the <HEAD>
section of the .html file
Variables declared in a function are local to the function
Parameters are all value
739
Array Objects
10
Creating arrays
Using the new operator and a constructor with multiple
arguments
var A = new Array("hello", 2, "you");
Using the new operator and a constructor with a single
numeric argument
var B = new Array(50);
Using square brackets to make a literal
var C = ["we", "can", 50, "mix", 3.5, "types"];
JavaScrript
10
JavaScrript
740
743
Array Objects
JavaScrript
10
Array Length
10
sort
Sort by default compares using alphabetical order
To sort using numbers we pass in a comparison
function defining how the numbers will be
compared
reverse
Reverse the items in an array
Array Objects
JavaScrript
742
Array Objects
Array Methods
There are a number of predefined operations that you
can do with arrays
concat two arrays into one
jjoin arrayy items into a single
g string
g ((commas
between)
push, pop, shift, unshift
Push and pop are a "right stack"
Shift and unshift are a "left stack"
741
744
124
JavaScript Objects
10
JavaScrript
JavaScrript
10
JavaScript Objects
745
my_tv.show = show_properties;
10
Regular Expressions
JavaScrript
JavaScrript
10
JavaScript Objects
s = "a
a man, a plan, a canal: panama";
panama ;
loc = s.search(/plan/);
matches1 = s.match(/an/g);
matches2 = s.match(/\w+/g);
s.replace(/\W/g, "-");
746
DOM
Note that the objects can be created and their properties can
be changed dynamically
Also, objects all have the same data type object
We can write constructor functions for objects if we'd like,
but these do not create new data types just easy ways of
uniformly initializing objects
10
JavaScrript
10
JavaScrript
749
JavaScript Objects
function TV(brand
TV(brand, size
size, injacks
injacks, outjacks)
{
this.brand = brand;
this.size = size;
this.jacks = new Object();
this.jacks.input = injacks;
this.jacks.output = outjacks;
}
748
747
750
125
10
JavaScrript
JavaScrript
10
Events
751
10
JavaScrript
10
JavaScrript
752
755
10
JavaScrript
10
JavaScrript
754
753
function doTransform(source){
var objXSL= new
ActiveXObject("Msxml2.DOMDocument");
objXSL.load("query1.xslt
query1.xslt");
str=source.transformNode(objXSL);
return (str);
}
756
126
10
758
761
10
JavaScrript
10
JavaScrript
760
Setting Cookies
ffunction
ti setCookie(){
tC ki (){
var the_name = prompt("What's your name?","");
var the_cookie = "wm_javascript=" + escape("username:" +
the_name);
document.cookie = the_cookie;
alert("Thanks, now go to the next page.");
}
BTE550 Internet and Intranet Applications
<html>
<head>
<title>Javascript and XSLT</title>
</head>
<body>
<script type = "text/javascript">
function doTransform(source){
var objXSL= new ActiveXObject("Msxml2.DOMDocument");
objXSL.load("query1.xslt");
str=source.transformNode(objXSL);
return (str);
}
var src= new ActiveXObject("Msxml2.DOMDocument");
src.load("imdb.xml");
var str=doTransform(src);
document.write(str);
</script>
</body>
</html>
BTE550 Internet and Intranet Applications
JavaScrript
757
10
10
JavaScrript
Reading Cookies
JavaScrript
JavaScrript
10
query1.xslt
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="MovieDataBase">
<html>
<head>
<title>Query</title>
</head>
<body>
s : o e c select="Movie">
se ec
ov e
<xsl:for-each
<xsl:for-each select="Genre">
<xsl:if test="node()='Drama'">
<li><xsl:value-of select="..//Title"/></li>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
759
762
127
10
JavaScrript
10
JavaScrript
function readTheCookie(the_info) {
// load the cookie into a variable and unescape it
var the_cookie = document.cookie;
var the_cookie = unescape(the_cookie);
// separate the values from the cookie name
var broken_cookie = the_cookie.split("=");
var the_values = broken_cookie[1];
// break each name:value pair into an array
var separated_values = the_values.split("/");
// loop through the list of name:values and load up the associate array
var property_value
l = "";
""
for (var loop = 0; loop < separated_values.length; loop++) {
property_value = separated_values[loop];
var broken_info = property_value.split(":");
var the_property = broken_info[0];
var the_value = broken_info[1];
the_info[the_property] = the_value;
}
}
763
10
764
function readCookie(name) {
if (document.cookie == '') {
// there's no cookie, so go no further
return false;
} else {
var firstChar, lastChar;
var theBigCookie = document.cookie;
firstChar = theBigCookie.indexOf(name);
// find the start of 'name'
if(firstChar != -1) {
// if you found the cookie
firstChar += name.length + 1;
// skip
ki 'name'
'
' andd '='
' '
lastChar = theBigCookie.indexOf(';', firstChar);
// Find the end of the value string (i.e. the next ';').
if(lastChar == -1) lastChar = theBigCookie.length;
return unescape(theBigCookie.substring(firstChar, lastChar));
} else {
// If there was no cookie of that name, return false.
return false;
}
}
}
BTE550 Internet and Intranet Applications
10
JavaScrript
JavaScrript
JavaScrript
10
766
Here's how to build a cookie that will last until the end of the Mayan
calendar:
function setCookie() {
// get the information
var the_name = prompt("What's your name?","");
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
// build and save the cookie
var the_cookie = "my_cookie=" + escape(the_name);
the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie = the_cookie;
}
BTE550 Internet and Intranet Applications
11
765
767
128
HTML Forms
Form Elements
Submission Methods: GET, POST
Form Processing: Server Side Processing
JSP
PHP
Textfield Component
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Content
769
772
11
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
770
773
Submit Button
11
Forms, JSP
P, PHP
11
771
p
is:
The HTML content for this component
29 Title: <input type=text name=title /> <br/><br/>
30 <input type=submit value=Add League />
31 </form>
774
129
Forms, JSP
P, PHP
11
JSP
JS
P
775
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Objectives
776
779
11
The first time a JSP page is requested, Web container converts the JSP
file into a servlet that can respond to the HTTP request.
Web container translates the JSP file into a Java source file that
contains a servlet class definition.
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
778
777
780
130
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
781
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
782
Forms, JSP
P, PHP
11
Comments
Forms, JSP
P, PHP
11
785
784
783
HTML comments
<!-- This is an HTML comment. It will show up in the response. -->
JSP page comments
<%-- This is a JSP comment. It will only be seen in the JSP code.
It will not show up in either the servlet code or the response.
--%>
Java comments
Java comments can be embedded with scriptlet and declaration
tags.
These comments are included in the servlet source code during
the translation phase, but do not appear in the HTTP response.
<%
/* This is a Java comment. It will show up in the servlet code.
It will not show up in the response. */
%>
BTE550 Internet and Intranet Applications
786
131
11
Declaration Tag
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Directive Tag
787
You can use a declaration tag to override the jspInit and jspDestory
life cycle methods.
The signature of these methods has no arguments and returns void.
For example:
<%!
public void jspInit() {
/* initialization code here */
}
public void jspDestroy() {
/* clean up code here */
}
%>
11
Scriptlet Tag
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Declaration Tag
788
11
Scriptlet Tag
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
791
Declaration Tag
790
792
132
Implicit Variables
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Expression Tag
793
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Expression Tag
796
Forms, JSP
P, PHP
11
Implicit Variables
The Web container gives the JSP technology developer
access to the following variables in scriptlet and
expression tags.
These variables represent commonly used objects for
servlets that JSP developers might need to use.
For example, you can retrieve HTML form parameter data
by using the request variable, which represents the
HttpServletRequest object.
795
PHP
798
133
11
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
What is PHP?
799
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
800
803
801
11
What is MySQL?
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
802
804
134
PHP
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
805
Forms, JSP
P, PHP
808
Why PHP?
PHP Syntax
806
Forms, JSP
P, PHP
Forms, JSP
P, PHP
809
11
Where to Start?
11
11
11
Forms, JSP
P, PHP
11
PHP + MySQL
807
A PHP file normally contains HTML tags, just like an HTML file,
and some PHP scripting code.
A simple PHP script which sends the text "Hello World" to the
browser:
<html>
<body><?php echo "Hello World"; ?></body>
</html>
A PHP scripting block always starts with <?php and ends with ?>.
A PHP scripting block can be placed anywhere in the document.
Each code line in PHP must end with a semicolon. The semicolon is
a separator and is used to distinguish one set of instructions from
another.
There are two basic statements to output text with PHP: echo and
print. In the example above we have used the echo statement to
output the text "Hello World".
BTE550 Internet and Intranet Applications
810
135
Variables in PHP
PHP variables
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Scalar Types
811
Scalar Types
11
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
815
Variables in PHP
813
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
Scalar Types
814
Variables in PHP
string
816
136
817
11
11
Forms, JSP
P, PHP
818
Operator
==
!=
>
<
>=
<=
Result
x=2
x+2
Subtraction
x=2
5-x
Multiplication
x=4
x*5
20
Division
15/5
5/2
3
2.5
10%2
1
0
++
Increment
x=5
x++
x=6
Decrement
x=5
x--
x=4
Operator
11
Example
Description
is equal to
is not equal
is greater than
is less than
is greater than or equal to
is less than or equal to
Example
5==8 returns false
5!=8 returns true
5>8 returns false
5<8 returns true
5>=8 returns false
5<=8 returns true
821
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
Description
Addition
--
820
Is The Same As
x=y
x=x+y
xx=x-y
xy
x=x*y
x=x/y
x=x%y
Operator
+
Example
x=y
x+=y
xx-=yy
x*=y
x/=y
x%=y
Comments in PHP
Forms, JSP
P, PHP
Operator
=
+=
-=
*=
/=
%=
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Variables in PHP
&&
||
819
Description Example
x=6
and
y=3
(x < 10 && y > 1) returns true
x=6
or
y=3
(x==5 || y==5) returns false
x=6
not
y=3
!(x==y) returns true
822
137
Conditional Statements
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
PHP Operators
823
11
if Statement
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
PHP Operators
To compare strings, use the C-like string comparison function,
strcmp()
Even the == operator has odd behavior in PHP when operands are
mixed
Ex: Consider comparing a string and an int
Any non-numeric PHP string value will equal 0
Any numeric PHP string will equal the number it represents
Ex: Consider comparing a string and a boolean
Regular PHP string value will equal true
0 string will equal false
This behavior is consistent but confusing to the programmer and
is probably best avoided
BTE550 Internet and Intranet Applications
824
825
11
Example
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
827
PHP Operators
826
828
138
832
Forms, JSP
P, PHP
11
while Statement
830
833
Example
Example
<html>
This is how it works: First we have a single
<body><?php
expression (most often a variable), that is evaluated
switch ($x)
once. The value of the expression is then compared
{
with the values for each case in the structure.
case 1:
If there is a match, the block of code associated
echo "Number 1";
break;
break
with that case is executed.
case 2:
Use break to prevent the code from running into
echo "Number
Number 2";
2 ;
th nextt case automatically.
the
t
ti ll
break;
break
The default statement is used if none of the cases
case 3:
are
true.
echo "Number 3";
break;
break
default:
default
echo "No number between 1 and 3";
}
?></body>
</html>
831
11
11
Forms, JSP
P, PHP
switch Statement
11
Forms, JSP
P, PHP
829
Forms, JSP
P, PHP
11
Looping
Very often when you write code, you want the same block of code
to run a number of times. You can use looping statements in your
code to perform this.
In PHP we have the following looping statements:
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
if Statement
If more than one line should be executed when a condition
is true, the lines should be enclosed within curly braces:
<html>
<body><?php
$x=10;
if ($x==10)
{
echo "Hello<br />";
echo "Good morning<br />";
}
?></body>
</html>
834
139
for Statement
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
do...while
do
while Statement
835
11
Example
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
Example
836
839
foreach Statement
11
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
for Statement
838
837
840
140
PHP Arrays
$b = $array;
$b[5] = 'Only in b';
No numerical index
<?
$array[0] = 1;
$array[5] = "This is element 5";
$array[200] = 300;
$array['one'] = "One";
$b does not overwrite $array
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
PHP Arrays
841
11
PHP Arrays
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
PHP Arrays
842
PHP Arrays
843
11
Forms, JSP
P, PHP
11
Forms, JSP
P, PHP
845
PHP Arrays
844
846
141
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
11
PHP Arrays
each returns an array of two items:
A key field for the current key
A value field for the current value
It returns the next (key,value) pair, then moves, so the first
item is no longer a special case
while ($curr = each($a1)):
$k = $curr["key"];
$v = $curr["value"];
echo "key is $k and value is $v <BR />\n";
endwhile;
11
11
Forms, JSP
P, PHP
Forms, JSP
P, PHP
848
849
851
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
11
Forms, JSP
P, PHP
11
Example
Forms, JSP
P, PHP
850
Form Validation
PHP Arrays
if, while, do, for, switch are virtually identical to those in C++
and Java
PHP allows for an alternative syntax to designate a block in the
if, while, for and switch statements
if (!isset($_REQUEST['email'])) {
header( "Location: form1.html" );
}
elseif (empty($email) || empty($message)) {
?>
<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you forgot to enter either your
email address or your message. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
BTE550 Internet and Intranet Applications
852
142
Forms, JSP
P, PHP
11
Form Validation
<?
}
else {
mail( "kurt@ce.itu.edu.tr", "Feedback Form Results",
$message "From:
$message,
From: $email
$email" );
header( "Location: form1.html" );
}
?>
853
Forms, JSP
P, PHP
11
[...preceding code...]
elseif (empty($email) || empty($message)) {
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . "
GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
?>
BTE550 Internet and Intranet Applications
854
143