1 / 11

CSCI 2910 Client/Server-Side Programming

CSCI 2910 Client/Server-Side Programming. Topic: Review XHTML and Forms. 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:

sybil-gibbs
Download Presentation

CSCI 2910 Client/Server-Side Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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: <p>This paragraph would <i>not be <b>legal</i> in XHTML.</p></b>

  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 <classroom> <teacher> <name>Dave Tarnoff</name> <userid>tarnoff</userid> </teacher> <student> <name>Abby Betsy Catcher</name> <userid>zabc123</userid> </student> <student> <name>David Ebenezer Fletcher</name> <userid>zdef456</userid> </student> <student> <name>George Harris Izod</name> <userid>zghi789</userid> </student> </classroom>

  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., <input type="text" name="userid" id="userid">

  7. Template for XHTML document <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Simple XHTML Document</title> </head> <body> <h1>Hello, World!</h1> </body> </html>

  8. XML Declaration • <?xml version="1.0" encoding="ISO-8859-1"?> • 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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> • 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. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

  11. XML Namespace and Language • <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> • 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 (xml:lang="en").

More Related