Presentation is loading. Please wait.

Presentation is loading. Please wait.

XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.

Similar presentations


Presentation on theme: "XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard."— Presentation transcript:

1 XP Tutorial 9 1 Working with XHTML

2 XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard capable of specifying many different types of markup languages. Device and System Independent MML: Math Markup Language is a markup language: Rendering Code

3 XP SGML  HTML SGML  XML  XHTML 3 SGML RULES HTML XML RULES XHTML Inconsistent, browser support difficult Consistent rules for efficient browser support Many other markup languages Other XML languages

4 XP HTML and XHTML 4 HTML (Hypertext Markup Language) 1998: Version 4.0 most current (4.01 not officially implemented) Can be applied inconsistently Browser code must be complex, inefficient, to handle inconsistencies. XHTML (Extensible Hypertext Markup Language) 2002: Version 1.1 most current (1.0 still extensively used) Strict standards for consistency. Browser code can be efficient, run on small devices.

5 XP XHTML Versions 5

6 XP About XHTML Documents 1. An XHTML document that correctly follows the syntax rules is called a well-formed document. 2. Because XHTML documents conform to XML rules, enter an “XML declaration” (XML Prolog) as the first line of the file. 3. A special document called a “DTD” (document type definition) is used to specify correct content and structure. 4. A special attribute called the “xhtml namespace” is inserted in the opening tag. 5. If the document is well-formed and also has correct content and structure, it is called a valid document. 6

7 XP An XHTML document that correctly follows the syntax rules is called a well-formed document. 7 “attribute minimization” not allowed

8 XP Because XHTML documents conform to XML rules, enter an “XML declaration” (XML Prolog) as the first line of the file. 8 For XHTML documents, use the declaration: XML Version number character encoding

9 XP A special document called a “DTD” (document type definition) is used to specify correct content and structure. 9 The DOCTYPE declaration, which tells which DTD is associated with the document, is the second line of the file, after the XML prolog statement. It is used to tell the browser what version of the markup language the page is written in.

10 XP Document Type Definition (“DTD”) 10 - The DTD specifies the rules for a valid document - There are 3 types of the XHTML DTD - Transitional: allows many of the older HTML features but not framesets - Frameset: allows many of the older HTML features including framesets - Strict: does not allow any presentational features or deprecated HTML elements and attributes. Does not support frames or inline frames. Used when there is a need to strictly conform to the latest standards - There are also definitions for straight HTML documents. dtd_list.txtdtd_list.txt This link can also be found on my Data for Labs page

11 XP Document Elements that are not valid under the Strict DTD 11 Elements not allowed under the strict DTD are: applet basefont center dir font frame frameset iframe isindex menu noframes s strike u http://www.w3schools.com/tags/tag_dir.asphttp://www.w3schools.com/tags/tag_dir.asp List and description of all tags

12 XP Attributes under the Strict DTD 12 Some attributes are restricted, while others are required in XHTML Restricted (prohibited) attributes under the strict XHTML DTD are shown on page 536 of the textbook. Required attributes under the strict XHTML DTD are shown on page 537 of the textbook.

13 XP Attributes Prohibited under the Strict DTD 13

14 XP Attributes Required under the Strict DTD 14

15 XP A special attribute called the “xhtml namespace” is inserted in the opening tag. 15 To set XHTML as the default namespace for a document, add the xmlns attribute to the html element with the following value: A namespace is any string of characters that uniquely identifies the set of elements and attributes belonging to the particular language. dtd_list.txtdtd_list.txt This link can also be found on my Data for Labs page

16 XP If the document is well-formed and also has correct content and structure, it is called a valid document 16 This is an example of an xhtml document that correctly conforms to the “Strict” DTD XHTML can be checked for validation at http://validator.w3.org http://validator.w3.org

17 XP Validation of XHTML 17 Click “Validate by File Upload” Click “Browse”

18 XP Validation of XHTML 18 Select the file you want to validate Click “Check”

19 XP Validation of XHTML 19 If it is valid, you get “…successfully checked...”

20 XP Validation of XHTML 20 This is an example of an xhtml document that does not conform to the “Strict” DTD (Can you see the error?)

21 XP Validation of XHTML 21 If it is not valid you get “Error found... “ “bgcolor” is not allowed under the strict DTD http://validator.w3.org

22 XP Validation of XHTML 22 To validate under a different version of the DTD, change the DOCTYPE declaration

23 XP Using Style Sheets and XHTML 23 Style sheets sometimes contain characters that could cause problems for the browser: A CDATA section marks a block of text so that the browser will not treat text as html code: > means any img element that is a direct descendent of a p element. If your code contains characters like >, it’s best to use an external style sheet instead of an embedded one.

24 XP Fixing XHTML Validation Errors 24 Some examples of things you might need to do to make an xhtml file pass the validator check: Convert body element attributes to styles in a style sheet.

25 XP Fixing XHTML Validation Errors 25 Some examples of things you might need to do to make an xhtml file pass the validator check: Correct errors for one or two-sided elements not properly closed or one-sided tags not terminated.

26 XP Fixing XHTML Validation Errors 26 Some examples of things you might need to do to make an xhtml file pass the validator check: Use the float style to align inline images. 180-img-styles.htm

27 XP Fixing XHTML Validation Errors 27 Some examples of things you might need to do to make an xhtml file pass the validator check: Remove/replace deprecated elements or attributes. 185-img-styles.htm

28 XP Fixing XHTML Validation Errors 28 Some examples of things you might need to do to make an xhtml file pass the validator check: Remove/replace deprecated elements or attributes.

29 XP Fixing XHTML Validation Errors 29 Some examples of things you might need to do to make an xhtml file pass the validator check: Remove/replace deprecated elements or attributes.

30 XP Fixing XHTML Validation Errors 30 Some examples of things you might need to do to make an xhtml file pass the validator check: Replace formatting done with and or by styles.

31 XP Fixing XHTML Validation Errors 31 Some examples of things you might need to do to make an xhtml file pass the validator check: Replace prohibited attributes such as name with a valid attribute such as id

32 XP The End 32


Download ppt "XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard."

Similar presentations


Ads by Google