Docsity

Creating XHTML - Web Programming - Lecture Slides, Slides of Computer Programming

Partial preview of the text

Download Creating XHTML - Web Programming - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

Creating XHTML and

HTML5 Documents

(The Basics)

Goals (XHTML HTML5)

 XHTML

 Separate document structure and content from document formatting  HTML  Create a formal (strict) version of HTML  Extend the language to include semantic elements and standard media elements to play video, audio, …  Adds what‟s missing instead of fixing what‟s wrong

XHTML and XML

 Simply put, XHTML is a specific XML vocabulary  Document Type Definitions (DTDs) are used to create XML vocabularies  There are many vocabularies in addition to XHTML  SOAP, XSLT, XPATH, and many more  Although not mentioned in the book, schemas are also commonly used for document validation

DTDs (Introduction)

 Document Type Definition (DTD) files are used to validate XML documents  That is, they describe the elements allowed in an XML document, and the order in which those elements must appear

 In this course you will use existing DTDs but you will not create them

Declaration

(Syntax XHTML)

DOCTYPE html type “public identifier” “URL”html denotes that the root node of the document to follow is HTML  type can be PUBLIC or SYSTEM  PUBLIC DTDs are available on the Web  PUBLIC identifier is magical  URL contains the location of the DTD  .NET fills all of this in for you

(Example 1)

 Sample XHTML

** **

XHTML and HTML5 Validation

 Visual Studio .NET automatically validates XHTML and HTML5 documents as you edit them  There‟s a validation tool at http://validator.w3.org  Note that most browsers WILL render invalid XHTML documents  I WILL NOT accept them though

HTML5 Document DTD

 It‟s been reduced down to:

XHTML Validation (Illustration)

Elements (Syntax)

 Elements have starting tags and ending tags  Starting tags appear in <> characters as in

 Ending tags appears in </> characters as in

 When there is no data a shorthand notation can be used as in

## Document Attributes

 Attributes are used to further configure an element  Some attribute names are common to almost all elements  Some attribute names are unique to a specific element

Document Attribute (Syntax)

 Attributes appear in an opening element tag  They appear as key/value pairs  An equal sign separates keys and values  A space separates multiple key/value pairs  Values are quoted

Element Family

 Semantic elements  Textual sematic element  Web forms (changed in HTML5)  Audio and video support  Canvas to draw graphics

Structural Elements

 **** must be the root element

 **** must appear next nested inside ****

 **** must appear next nested inside ****

 These elements are optional in HTML5 but required in XHTML