Lecture-4 Internet and Web Programming Architecture – Part 1
Lecture-4 Internet and Web Programming Architecture – Part 1
Lecture-4
Internet and Web Programming
& Architecture – Part 1
Programming the Web
Client-Side Programming
Static document formats for the web
Document forms: HTML and CSS
Data forms: XML, DTDs and Schemas, XSL
High-end graphics forms: VRML, SVG
Client-side interactive web pages
Client-Side Scripting languages: JavaScript, VBScript
Client-Side embedded applications: Java applets, ActiveX,
Flash
Server-Side Programming
Server-side web page creation
Scripting languages: CGI and Perl, PHP, ColdFusion
High-level frameworks: Servlets and JSP, ASP, ASP.NET
Web Programming – Language Model
Client Side
Server Side
Cascading
ActiveX HTML
JavaScript Style
Controls Controls
C# Sheets
WebForms JavaScript
VBScript
XHTML
Static document
formats for the web
HTML
HyperText Markup Language
Primary document type for the web
Transmitted using the HTTP protocol
“Well-Formed Document”
Tree structure with proper nesting
Attributes are not repeated in same tag
Document Object Model (DOM)
When a web page is loaded, the browser creates
a Document Object Model of the page.
DOM is a programming interface for web (Web APIs)
documents.
It represents the page so that programs can change the
document structure, style, and content.
The DOM represents the document as nodes and
objects; that way, programming languages can interact
with the page.
HTML DOM Node Tree
XML Programming with DOM
XML DOM is a standard object model for XML.
XML documents have a hierarchy of informational
units called nodes;
DOM is a standard programming interface of
describing those nodes and the relationships between
them.
XML DOM also provides an API that allows a
developer to add, edit, move or remove nodes at
any point on the tree in order to create an
application.
Advantages of XML DOM
XML DOM is language and platform
independent.
XML DOM is traversable
Information in XML DOM is organized in a hierarchy
which allows developer to navigate around the
hierarchy looking for specific information.
XML DOM is modifiable
It is dynamic in nature providing the developer a
scope to add, edit, move or remove nodes at any
point on the tree.
DTD
A document type definition (DTD) provides you with the
means to validate XML files against a set of rules.
When you create a DTD file, you can specify rules that control
the structure of any XML files that reference the DTD file.
A DTD can contain declarations that define elements,
attributes, notations, and entities for any XML files that
reference the DTD file.
Usually placed in separate file
XML refers to HTML file using following header:
<!DOCTYPE root-element SYSTEM
"filename">
DTD can be placed inline
An XML document is Valid if it conforms to the DTD
Limitations of DTD
DTD is weaker than database schemas
DTD does not have XML syntax and offers only
limited support for types or name spaces
No abstractions such as sets
DTD provides very limited support for modularity,
reuse, and evolution of schemas.
No constraints
XML-Schema provides these capabilities
Important for e-commerce
XML-Schema
Replacement for DTDs
Written in XML
More extensible to future additions
Support built-in and user-defined data types
Including typed references and complex data
types
Support constraints
XML-Schema
<xs:schema> header has following attributes:
Namespace for XML Schema built-in tags
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Namespace for elements defined by schema
targetNamespace=“http://www.uridekel.com”
Default namespace
xmlns=“http://www.uridekel.com”
Whether documents must use qualified names
elementFormDefault="qualified"
XML file refers to schema :
<note xmlns="http://www.uridekel.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=http://www.uridekel.com/pers.xsd>
Advantages of XML-Schema
It is easier to describe allowable document
content.
It is easier to validate the correctness of data.
It is easier to define data facets (restrictions on
data)
It is easier to define data patterns (data formats)
It is easier to convert data between different data
types.
XSL
Extensible Stylesheet Language
Intended to assist in presenting XML data
CSS is not enough because it refers to HTML tags that
have some display semantics
Responsible for transforming an XML document into an
XHTML document
Consists of three languages:
XSLT for transforming XML documents
XPath for defining parts of XML documents
XSL-FO for formatting the elements
XSLT
XSL (eXtensible Stylesheet Language) is a
styling language for XML.