CSCI 2910 Client/Server-Side Programming - PowerPoint PPT Presentation

About This Presentation
Title:

CSCI 2910 Client/Server-Side Programming

Description:

CSCI 2910 Client/Server-Side Programming. Difference Between HTML and XHTML ... Allows use of deprecated elements. Allows for widest audience. ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 12
Provided by: facult2
Learn more at: http://faculty.etsu.edu
Category:

less

Transcript and Presenter's Notes

Title: CSCI 2910 Client/Server-Side Programming


1
CSCI 2910 Client/Server-Side Programming
  • Topic Review XHTML and Forms

2
Difference Between HTML and XHTML
  • The purpose of HTML tags is to turn on and off
    formatting. Because of this, it isn't vital to
    observe rules such as nesting. For example, in
    HTML, the following code is okay
  • ltpgtThis paragraph would ltigtnot be
  • ltbgtlegallt/igt in XHTML.lt/pgtlt/bgt

3
Difference Between HTML XHTML (continued)
  • XHTML is an application of HTML that follows the
    rules of XML
  • The purpose of XML tags is to contain data. If
    the following document were not properly nested,
    there would trouble trying to identify the data.

4
XML Example
  • ltclassroomgt
  • ltteachergt
  • ltnamegtDave Tarnofflt/namegt
  • ltuseridgttarnofflt/useridgt
  • lt/teachergt
  • ltstudentgt
  • ltnamegtAbby Betsy Catcherlt/namegt
  • ltuseridgtzabc123lt/useridgt
  • lt/studentgt
  • ltstudentgt
  • ltnamegtDavid Ebenezer Fletcherlt/namegt
  • ltuseridgtzdef456lt/useridgt
  • lt/studentgt
  • ltstudentgt
  • ltnamegtGeorge Harris Izodlt/namegt
  • ltuseridgtzghi789lt/useridgt
  • lt/studentgt
  • lt/classroomgt

5
Benefits of XHTML over HTML
  • Easy to introduce new elements. (HTML typically
    only added new elements when IE/Netscape
    competition resulted in a new tag.) XHTML can be
    extended beyond predefined elements.
  • More rigorous syntax makes for simpler browser
    code which is good for products such as cell
    phones.
  • Better portability across different platforms.

6
Differences between HTML XHTML
  • Documents must be well formed
  • Must have opening and closing tags for container
    tags
  • New format for in-line tags
  • Must be properly nested
  • Element and attribute names must be in lower case
  • Attribute values must always be in quotations
  • Attribute minimization is not allowed, e.g.,
    NORESIZE must be noresize"noresize"
  • Identify elements using both name and id
    attributes, e.g., ltinput type"text"
    name"userid" id"userid"gt

7
Template for XHTML document
  • lt?xml version"1.0" encoding"ISO-8859-1"?gt
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Strict//EN"
  • "http//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
    "gt
  • lthtml xmlns"http//www.w3.org/1999/xhtml"
    xmllang"en" lang"en"gt
  • ltheadgt
  • lttitlegtSimple XHTML Documentlt/titlegt
  • lt/headgt
  • ltbodygt
  • lth1gtHello, World!lt/h1gt
  • lt/bodygt
  • lt/htmlgt

8
XML Declaration
  • lt?xml version"1.0" encoding"ISO-8859-1"?gt
  • The XML declaration defines the XML version and
    the character encoding that should be used to
    interpret the document.
  • Computers store all information as 1's and 0's.
    There are different ways to represent characters
    using these 1's and 0's. The character encoding
    used by a document is the method to use when
    converting the 1's and 0's into characters.

9
DOCTYPE Tag
  • lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Strict//EN"
  • "http//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
    "gt
  • The W3C has defined a document type definition
    (DTD) to be, "...a collection of declarations
    that, as a collection, defines the legal
    structure, elements, and attributes that are
    available for use in a document that complies to
    the DTD."
  • The DOCTYPE tag identifies which DTD the browser
    is supposed to use when displaying the XHTML
    document.

10
Three DTD Types
  • Strict DTD Adheres exactly to XHTML standard.
  • Transitional DTD Uses HTML rather than CSS to
    format page. Allows use of deprecated elements.
    Allows for widest audience.
  • Frameset DTD Used when document is partitioned
    into 2 or more frames.

lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN "http//www.w3.org/TR/xhtml1/DTD/xhtml
1-strict.dtd"gt
lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN "http//www.w3.org/TR/xhtml1/DTD
/xhtml1-transitional.dtd"gt
lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Frameset//EN "http//www.w3.org/TR/xhtml1/DTD/xht
ml1-frameset.dtd"gt
11
XML Namespace and Language
  • lthtml xmlns"http//www.w3.org/1999/xhtml"
    xmllang"en" lang"en"gt
  • The W3C has defined an XML namespace as, "a
    collection of names, identified by a URI (uniform
    resource identifier) reference, which is used in
    XML documents as element types and attribute
    names."
  • The html tag is used to define the language for
    the XHTML document (lang"en") and for the XML
    used (xmllang"en").
Write a Comment
User Comments (0)
About PowerShow.com