SlideShare a Scribd company logo
1 of 33
XHTML VALIDATION
Design | Development | Marketing
GOALS
By the end of this unit, you should
understand …
… the reasons for moving to XHTML.
… how to use a DOCTYPE statement.
… how to use the World Wide Web
Consortium's Validator.
… how to specify character encoding for
a page.
… the rules for HTML 4.01 Strict &
XHTML 1.0.
Design | Development | Marketing
WHY BOTHER WITH XHTML?
HTML was working great … Why bother with XHTML?
 We can create pages that work uniformly across browsers ("graceful
decomposition").
 We can create pages that work on mobile devices.
 We can create pages that work with adaptive technology.
 XHTML pages "play well" with CSS.
Design | Development | Marketing
LOOKS ARE DECEIVING …
Most browsers are very forgiving
when it comes to display error-
ridden HTML.
The problem is that, although
browsers might display that
contains errors, they display the
errors differently.
Writing standards-compliant pages
is the only way to guarantee some
semblance of consistency.
Design | Development | Marketing
SOME HISTORY
Prior to HTML v4.0, what we called
"HTML" was actually a mishmash of
rules and design standards – each
browser manufacturer had their own
"version" of HTML.
HTML 4.0/4.01 changed that – for the
first time, industry leaders agreed on a
standard model for HTML (structure)
and CSS (style).
XHTML blends the browser compatibility
and popularity of HTML with
extensibility of XML.
Design | Development | Marketing
WHICH VERSION?
Today, unless told otherwise, web browsers
display pages as if those pages used old-
style HTML.
This is a problem, because there is little
consistency among the browsers in how
to display old-style HTML that contains
errors.
However, armed with standards-compliant
XHTML, we can really unlock the power of
web development. We just need to let the
browser know we are using it …
Design | Development | Marketing
THE DOCTYPE STATEMENT
To help the browser understand the
language in which we write a
document, we can add a DOCTYPE
statement at the top of our script
(even before <html>).
The DOCTYPE statement, technically
called a Document Type
Definition (DTD), instructs the
browser to use a standards-
compliant model for displaying your
page.
Design | Development | Marketing
DOCTYPE SYNTAX
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
A B C
E
A The ! specifies a Document Type
Definition. This is NOT an HTML
Element!
B Specifies html as the root (first)
element in the page.
D
C
Declares that the standard
(HTML 4.01 here) is publicly
available.
D
Tells the browser which standard we’re
using (HTML 4.01 here) and the human
language we use in the page (EN –
English). Everything in the quotes needs
to be on the same line!
E Points to the URL for the standard.
Design | Development | Marketing
LET’S TRY ONE!
Download the file
n241IntroducingXHTMLAnd
Validation_examples.zip
to your storage device.
Decompress that file and
then edit the file
called lounge.html. Add
the DOCTYPE (you copy
the DOCTYPE from the
file called doctype.txt.
Open the file in a
browser. Any
difference?
Design | Development | Marketing
VALIDATING WEB PAGES
Sometimes, it’s a difficult process to detect the minor mistakes that
can make your page non-compliant.
Fortunately, the W3C has a tool that can help – the W3C Markup
Validation Service:
http://validator.w3.org/
Design | Development | Marketing
LET’S TRY ONE!
Open the W3C
Validator:
http://validator.w3.org
Use the “Validate
by File Upload”
option to
validate the
following file:
lounge.html.
Design | Development | Marketing
THE <IMG> ELEMENT’S
ALT ATTRIBUTEThe rules of HTML 4.01 state that every <img> element must have an
alt attribute. Why?
Add an alt attribute to the drinks.gif image and validate your page
again …
Design | Development | Marketing
CHARACTER ENCODING
In the previous validation, the
Validator indicated that our page
had no character encoding.
What is character encoding? It
“tells” the browser which
character set to use in order to
display the page – English,
Chinese, Arabic, etc.
To include a character encoding
scheme, we will use a <meta>
element …
Design | Development | Marketing
THE <META> ELEMENT
A <meta> element tells a browser
information about the page. Here are
some things a <meta> element can do:
 It can set a character encoding scheme.
 It can configure a browser re-direct to another page.
 It can attract search engines.
You can have multiple <meta> elements
in a single HTML file.
We nest the <meta> element inside the
<head> element, before the <title>.
Design | Development | Marketing
SPECIFYING CHARACTER ENCODING
Add the following line above the
<title> element in lounge.html.
Then, run your page through the
validator:
<meta http-equiv = “Content-Type”
content = “text/html; charset=ISO-8859-1”>
Design | Development | Marketing
MOVING TO A STRICT DTD …
Did you notice the word “Transitional”
in DOCTYPE statement? It means that
we are using a transitional DTD. The
Transitional DTD allows for some
legacy HTML code, but enforces basic
rules of structure. The W3C created it
to help those with huge websites that
they needed to update.
Those creating new websites should use
a strict DTD.
Design | Development | Marketing
LET’S TRY ONE!
Change the DOCTYPE declaration in
lounge.html to the declaration
below. Then, run your page through
the validator:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Design | Development | Marketing
NESTING ELEMENTS
According to the guidelines for
HTML 4.01, Strict, you MUST nest
inline elements, like the <img>
element, inside a block level
element.
Nest the <img> element in
lounge.html inside a <p> and
then run your page through the
validator …
Design | Development | Marketing
CONGRATULATIONS!
Now you can celebrate and say that you’ve joined the ranks of true Web
Geeks by creating an HTML 4.01 Strict page!
Now for some HTML 4.01 Strict rules …
Design | Development | Marketing
RULES FOR HTML 4.01 STRICT
The first line in an HTML 4.01 Strict
document must be a DOCTYPE
declaration.
The <html> element must be the first
line after the DOCTYPE declaration.
A compliant page includes both <head>
and <body> elements.
A compliant page includes a <title>
element, nested in the <head>.
continued …
Design | Development | Marketing
RULES FOR HTML 4.01 STRICT
Nest ONLY block elements inside a
<body> element; all inline elements
need to be nested inside other block-
level elements.
Do NOT nest block-level elements inside
inline elements.
Do NOT nest block-level elements inside
the <p> element.
Only nest <li> elements inside the <ol>
& the <ul> elements.
continued …
Design | Development | Marketing
RULES FOR HTML 4.01 STRICT
You may nest text, inline or block-level
elements inside the <li> element.
The <blockquote> elements requires
one or more block-level elements
nested inside of it.
Take care when nesting inline elements
inside other inline elements:
 NEVER nest an <a> element inside another <a> element.
 NEVER nest any other element inside an empty element, like the
<img> element.
 Remember to close nested elements in the opposite way that you
opened them!
Design | Development | Marketing
MOVING TO XHTML …
XHTML – eXtensible HTML – is the
“next evolution” of HTML.
XHTML is actually a form of
eXtensible Markup Language
(XML), which allows developers to
extend existing scripting
languages and create new
languages to fit their business
needs.
Let’s consider a sample XML
document …
Design | Development | Marketing
<recipe xmlns=“http://www.foodnetwerk.com/recipe”<recipe xmlns=“http://www.foodnetwerk.com/recipe”
lang=“en” xml:lang=“en”>lang=“en” xml:lang=“en”>
<name>Head First Lounge Iced Tea</name><name>Head First Lounge Iced Tea</name>
<description><description>
A brisk iced tea with a bit of a kick ...A brisk iced tea with a bit of a kick ...
</description></description>
<ingredients><ingredients>
<ingredient measurement=“6 cups”><ingredient measurement=“6 cups”>
WaterWater
</ingredient></ingredient>
......
</ingredients></ingredients>
<preparation><preparation>
<time duration=“10 minutes” /><time duration=“10 minutes” />
<step><step>
Boil one cup of water in a pan, remove pan ...Boil one cup of water in a pan, remove pan ...
</step></step>
......
</preparation></preparation>
</recipe></recipe>
Sample XML ScriptSample XML Script
Design | Development | Marketing
WHY MOVE TO XHTML?
XHTML is more compatible with adaptive
web software, like aural screen
readers.
The syntax is almost exactly like HTML;
if you know how to write in HTML 4.01
Strict, the transition is almost
seamless. In fact, XHTML is backwards
compatible.
XHTML is more compatible with mobile
web agents like cell phones and PDAs.
continued …
Design | Development | Marketing
WHY MOVE TO XHTML?
Because XHTML is XML, you write new
markup for it; there are already extensions
to XHTML for vector graphics and
mathematics.
Any software that can read XML can read
XHTML.
Many large databases store data using XML;
transitioning to XHTML will be easier than
HTML.
Since XHTML is XML, we reap the benefits of
XML, including the ability to store large,
structured documents.
Design | Development | Marketing
LET’S TRY ONE!
Change the DOCTYPE declaration in
lounge.html to the declaration
below. DON’T run your page through
the validator, just yet!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">
Design | Development | Marketing
ALMOST THERE …
Change the <html> element in
lounge.html to add the attributes
below. Then, run your page through
the validator.
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en"
xml:lang="en">
Design | Development | Marketing
CLOSING EMPTY TAGS
We already know that any paired element
contains two tags – an opening tag and
a closing tag.
XHTML, however, requires that you also
close empty elements.
To close an empty element (like <img> or
<meta> use " />" at the end of the tag
name, like this:
<meta />
Update lounge.html and then validate
…
Design | Development | Marketing
RULES FOR XHTML
The <html> element must include
xmlns, lang and xml:lang attributes.
The <html> element must be the first
tag after the DOCTYPE declaration.
Write element names in lowercase.
Close empty elements with a space
and then a /, like this <tag />.
continued …
Design | Development | Marketing
RULES FOR XHTML
Enclose attribute values in double
quotes, like this:
<tag attribute = "value">
Attribute values must not be empty.
Use entities in the place of the &
character and other special
characters. See the following URL
for entity codes:
http://www.w3schools.com/tags/ref_entities.asp
Design | Development | Marketing
TIPS FOR DEBUGGING
Pay close attention to the line
number the validator returns;
don't stress over the exact error
message.
When the validator returns multiple
errors, correct one error at a
time, starting with the top error.
Then, re-validate.
Design | Development | Marketing
CONTACT US
http://marketing.clicksbazaar.com/xhtml-
validation
http://clicksbazaar.com |
Contact@clicksbazaar.com
Design | Development | Marketing

More Related Content

What's hot

Web designing course
Web designing courseWeb designing course
Web designing coursemandeep Singh
 
Web development | Derin Dolen
Web development | Derin Dolen Web development | Derin Dolen
Web development | Derin Dolen Derin Dolen
 
Build a DNN Module in Minutes
Build a DNN Module in MinutesBuild a DNN Module in Minutes
Build a DNN Module in MinutesWill Strohl
 
1-01: Introduction To Web Development
1-01: Introduction To  Web  Development1-01: Introduction To  Web  Development
1-01: Introduction To Web Developmentapnwebdev
 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateSean Burgess
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3Darren Wood
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web DevelopmentRobert Nyman
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web developmentMohammed Safwat
 
Internship presentation
Internship presentationInternship presentation
Internship presentationWasim Shemna
 
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site Clean
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site CleanEvaluating Extensions: A Comprehensive Guide to Keeping Your Site Clean
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site CleanWill Strohl
 
PSD to HTML Conversion
PSD to HTML ConversionPSD to HTML Conversion
PSD to HTML ConversionDarryl Sherman
 
Website Development Process
Website Development ProcessWebsite Development Process
Website Development ProcessHend Al-Khalifa
 
Building DotNetNuke Modules
Building DotNetNuke ModulesBuilding DotNetNuke Modules
Building DotNetNuke ModulesEngage Software
 

What's hot (20)

Web designing course
Web designing courseWeb designing course
Web designing course
 
DNN Basics
DNN BasicsDNN Basics
DNN Basics
 
Web development | Derin Dolen
Web development | Derin Dolen Web development | Derin Dolen
Web development | Derin Dolen
 
WEB DESIGNING
WEB DESIGNINGWEB DESIGNING
WEB DESIGNING
 
Build a DNN Module in Minutes
Build a DNN Module in MinutesBuild a DNN Module in Minutes
Build a DNN Module in Minutes
 
1-01: Introduction To Web Development
1-01: Introduction To  Web  Development1-01: Introduction To  Web  Development
1-01: Introduction To Web Development
 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3
 
WEB DESIGN
WEB DESIGNWEB DESIGN
WEB DESIGN
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web Development
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
Internship presentation
Internship presentationInternship presentation
Internship presentation
 
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site Clean
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site CleanEvaluating Extensions: A Comprehensive Guide to Keeping Your Site Clean
Evaluating Extensions: A Comprehensive Guide to Keeping Your Site Clean
 
Web Development
Web DevelopmentWeb Development
Web Development
 
Wix
WixWix
Wix
 
PSD to HTML Conversion
PSD to HTML ConversionPSD to HTML Conversion
PSD to HTML Conversion
 
Wordpress 101 Training
Wordpress 101 TrainingWordpress 101 Training
Wordpress 101 Training
 
Website Development Process
Website Development ProcessWebsite Development Process
Website Development Process
 
Building DotNetNuke Modules
Building DotNetNuke ModulesBuilding DotNetNuke Modules
Building DotNetNuke Modules
 
Web designing
Web designingWeb designing
Web designing
 

Similar to Xhtml validation

GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1Heather Rock
 
Web development intership Presentation.pptx
Web development intership Presentation.pptxWeb development intership Presentation.pptx
Web development intership Presentation.pptxbodepallivamsi1122
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptTroyfawkes
 
HTML 5 Complete Reference
HTML 5 Complete ReferenceHTML 5 Complete Reference
HTML 5 Complete ReferenceEPAM Systems
 
HTML (Hyper Text Markup Language)
HTML (Hyper Text Markup Language)HTML (Hyper Text Markup Language)
HTML (Hyper Text Markup Language)actanimation
 
Introduction to HTML 5
Introduction to HTML 5Introduction to HTML 5
Introduction to HTML 5RAHUL SHARMA
 
Introduction to html5
Introduction to html5Introduction to html5
Introduction to html5Manav Prasad
 
Web Designing Training in Ambala ! BATRA COMPUTER CENTRE
Web Designing Training in Ambala ! BATRA COMPUTER CENTREWeb Designing Training in Ambala ! BATRA COMPUTER CENTRE
Web Designing Training in Ambala ! BATRA COMPUTER CENTREjatin batra
 
LIS3353 SP12 Week 8
LIS3353 SP12 Week 8LIS3353 SP12 Week 8
LIS3353 SP12 Week 8Amanda Case
 
Introduction to html55
Introduction to html55Introduction to html55
Introduction to html55subrat55
 

Similar to Xhtml validation (20)

GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1GDI Seattle Intro to HTML and CSS - Class 1
GDI Seattle Intro to HTML and CSS - Class 1
 
4. HTML Guide - To Print
4. HTML Guide - To Print4. HTML Guide - To Print
4. HTML Guide - To Print
 
Web development intership Presentation.pptx
Web development intership Presentation.pptxWeb development intership Presentation.pptx
Web development intership Presentation.pptx
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
 
Let me design
Let me designLet me design
Let me design
 
HTML 5 Complete Reference
HTML 5 Complete ReferenceHTML 5 Complete Reference
HTML 5 Complete Reference
 
HTML (Hyper Text Markup Language)
HTML (Hyper Text Markup Language)HTML (Hyper Text Markup Language)
HTML (Hyper Text Markup Language)
 
Introduction to HTML 5
Introduction to HTML 5Introduction to HTML 5
Introduction to HTML 5
 
Dreaweaver cs5
Dreaweaver cs5Dreaweaver cs5
Dreaweaver cs5
 
Day1
Day1Day1
Day1
 
Introduction to html5
Introduction to html5Introduction to html5
Introduction to html5
 
INTRODUCTIONS OF HTML
INTRODUCTIONS OF HTMLINTRODUCTIONS OF HTML
INTRODUCTIONS OF HTML
 
Web Designing Training in Ambala ! BATRA COMPUTER CENTRE
Web Designing Training in Ambala ! BATRA COMPUTER CENTREWeb Designing Training in Ambala ! BATRA COMPUTER CENTRE
Web Designing Training in Ambala ! BATRA COMPUTER CENTRE
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
LIS3353 SP12 Week 8
LIS3353 SP12 Week 8LIS3353 SP12 Week 8
LIS3353 SP12 Week 8
 
Html.pptx
Html.pptxHtml.pptx
Html.pptx
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
Introduction to html55
Introduction to html55Introduction to html55
Introduction to html55
 

More from clicksbazaar

Website design services
Website design servicesWebsite design services
Website design servicesclicksbazaar
 
Timeline cover designing
Timeline cover designingTimeline cover designing
Timeline cover designingclicksbazaar
 
Social media optimization services
Social media optimization servicesSocial media optimization services
Social media optimization servicesclicksbazaar
 
Link building service
Link building serviceLink building service
Link building serviceclicksbazaar
 
Graphics designing service
Graphics designing serviceGraphics designing service
Graphics designing serviceclicksbazaar
 
Google penalty recovery
Google penalty recoveryGoogle penalty recovery
Google penalty recoveryclicksbazaar
 
Email marketing service
Email marketing serviceEmail marketing service
Email marketing serviceclicksbazaar
 
Corporate marketing service
Corporate marketing serviceCorporate marketing service
Corporate marketing serviceclicksbazaar
 
Brand management service
Brand management serviceBrand management service
Brand management serviceclicksbazaar
 
Apps development service
Apps development serviceApps development service
Apps development serviceclicksbazaar
 
Android apps development service
Android apps development serviceAndroid apps development service
Android apps development serviceclicksbazaar
 
All in one on page seo
All in one on page seoAll in one on page seo
All in one on page seoclicksbazaar
 
All in one off page seo
All in one off page seoAll in one off page seo
All in one off page seoclicksbazaar
 

More from clicksbazaar (14)

Website design services
Website design servicesWebsite design services
Website design services
 
Timeline cover designing
Timeline cover designingTimeline cover designing
Timeline cover designing
 
Social media optimization services
Social media optimization servicesSocial media optimization services
Social media optimization services
 
Seo service
Seo serviceSeo service
Seo service
 
Link building service
Link building serviceLink building service
Link building service
 
Graphics designing service
Graphics designing serviceGraphics designing service
Graphics designing service
 
Google penalty recovery
Google penalty recoveryGoogle penalty recovery
Google penalty recovery
 
Email marketing service
Email marketing serviceEmail marketing service
Email marketing service
 
Corporate marketing service
Corporate marketing serviceCorporate marketing service
Corporate marketing service
 
Brand management service
Brand management serviceBrand management service
Brand management service
 
Apps development service
Apps development serviceApps development service
Apps development service
 
Android apps development service
Android apps development serviceAndroid apps development service
Android apps development service
 
All in one on page seo
All in one on page seoAll in one on page seo
All in one on page seo
 
All in one off page seo
All in one off page seoAll in one off page seo
All in one off page seo
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Xhtml validation

  • 1. XHTML VALIDATION Design | Development | Marketing
  • 2. GOALS By the end of this unit, you should understand … … the reasons for moving to XHTML. … how to use a DOCTYPE statement. … how to use the World Wide Web Consortium's Validator. … how to specify character encoding for a page. … the rules for HTML 4.01 Strict & XHTML 1.0. Design | Development | Marketing
  • 3. WHY BOTHER WITH XHTML? HTML was working great … Why bother with XHTML?  We can create pages that work uniformly across browsers ("graceful decomposition").  We can create pages that work on mobile devices.  We can create pages that work with adaptive technology.  XHTML pages "play well" with CSS. Design | Development | Marketing
  • 4. LOOKS ARE DECEIVING … Most browsers are very forgiving when it comes to display error- ridden HTML. The problem is that, although browsers might display that contains errors, they display the errors differently. Writing standards-compliant pages is the only way to guarantee some semblance of consistency. Design | Development | Marketing
  • 5. SOME HISTORY Prior to HTML v4.0, what we called "HTML" was actually a mishmash of rules and design standards – each browser manufacturer had their own "version" of HTML. HTML 4.0/4.01 changed that – for the first time, industry leaders agreed on a standard model for HTML (structure) and CSS (style). XHTML blends the browser compatibility and popularity of HTML with extensibility of XML. Design | Development | Marketing
  • 6. WHICH VERSION? Today, unless told otherwise, web browsers display pages as if those pages used old- style HTML. This is a problem, because there is little consistency among the browsers in how to display old-style HTML that contains errors. However, armed with standards-compliant XHTML, we can really unlock the power of web development. We just need to let the browser know we are using it … Design | Development | Marketing
  • 7. THE DOCTYPE STATEMENT To help the browser understand the language in which we write a document, we can add a DOCTYPE statement at the top of our script (even before <html>). The DOCTYPE statement, technically called a Document Type Definition (DTD), instructs the browser to use a standards- compliant model for displaying your page. Design | Development | Marketing
  • 8. DOCTYPE SYNTAX <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> A B C E A The ! specifies a Document Type Definition. This is NOT an HTML Element! B Specifies html as the root (first) element in the page. D C Declares that the standard (HTML 4.01 here) is publicly available. D Tells the browser which standard we’re using (HTML 4.01 here) and the human language we use in the page (EN – English). Everything in the quotes needs to be on the same line! E Points to the URL for the standard. Design | Development | Marketing
  • 9. LET’S TRY ONE! Download the file n241IntroducingXHTMLAnd Validation_examples.zip to your storage device. Decompress that file and then edit the file called lounge.html. Add the DOCTYPE (you copy the DOCTYPE from the file called doctype.txt. Open the file in a browser. Any difference? Design | Development | Marketing
  • 10. VALIDATING WEB PAGES Sometimes, it’s a difficult process to detect the minor mistakes that can make your page non-compliant. Fortunately, the W3C has a tool that can help – the W3C Markup Validation Service: http://validator.w3.org/ Design | Development | Marketing
  • 11. LET’S TRY ONE! Open the W3C Validator: http://validator.w3.org Use the “Validate by File Upload” option to validate the following file: lounge.html. Design | Development | Marketing
  • 12. THE <IMG> ELEMENT’S ALT ATTRIBUTEThe rules of HTML 4.01 state that every <img> element must have an alt attribute. Why? Add an alt attribute to the drinks.gif image and validate your page again … Design | Development | Marketing
  • 13. CHARACTER ENCODING In the previous validation, the Validator indicated that our page had no character encoding. What is character encoding? It “tells” the browser which character set to use in order to display the page – English, Chinese, Arabic, etc. To include a character encoding scheme, we will use a <meta> element … Design | Development | Marketing
  • 14. THE <META> ELEMENT A <meta> element tells a browser information about the page. Here are some things a <meta> element can do:  It can set a character encoding scheme.  It can configure a browser re-direct to another page.  It can attract search engines. You can have multiple <meta> elements in a single HTML file. We nest the <meta> element inside the <head> element, before the <title>. Design | Development | Marketing
  • 15. SPECIFYING CHARACTER ENCODING Add the following line above the <title> element in lounge.html. Then, run your page through the validator: <meta http-equiv = “Content-Type” content = “text/html; charset=ISO-8859-1”> Design | Development | Marketing
  • 16. MOVING TO A STRICT DTD … Did you notice the word “Transitional” in DOCTYPE statement? It means that we are using a transitional DTD. The Transitional DTD allows for some legacy HTML code, but enforces basic rules of structure. The W3C created it to help those with huge websites that they needed to update. Those creating new websites should use a strict DTD. Design | Development | Marketing
  • 17. LET’S TRY ONE! Change the DOCTYPE declaration in lounge.html to the declaration below. Then, run your page through the validator: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Design | Development | Marketing
  • 18. NESTING ELEMENTS According to the guidelines for HTML 4.01, Strict, you MUST nest inline elements, like the <img> element, inside a block level element. Nest the <img> element in lounge.html inside a <p> and then run your page through the validator … Design | Development | Marketing
  • 19. CONGRATULATIONS! Now you can celebrate and say that you’ve joined the ranks of true Web Geeks by creating an HTML 4.01 Strict page! Now for some HTML 4.01 Strict rules … Design | Development | Marketing
  • 20. RULES FOR HTML 4.01 STRICT The first line in an HTML 4.01 Strict document must be a DOCTYPE declaration. The <html> element must be the first line after the DOCTYPE declaration. A compliant page includes both <head> and <body> elements. A compliant page includes a <title> element, nested in the <head>. continued … Design | Development | Marketing
  • 21. RULES FOR HTML 4.01 STRICT Nest ONLY block elements inside a <body> element; all inline elements need to be nested inside other block- level elements. Do NOT nest block-level elements inside inline elements. Do NOT nest block-level elements inside the <p> element. Only nest <li> elements inside the <ol> & the <ul> elements. continued … Design | Development | Marketing
  • 22. RULES FOR HTML 4.01 STRICT You may nest text, inline or block-level elements inside the <li> element. The <blockquote> elements requires one or more block-level elements nested inside of it. Take care when nesting inline elements inside other inline elements:  NEVER nest an <a> element inside another <a> element.  NEVER nest any other element inside an empty element, like the <img> element.  Remember to close nested elements in the opposite way that you opened them! Design | Development | Marketing
  • 23. MOVING TO XHTML … XHTML – eXtensible HTML – is the “next evolution” of HTML. XHTML is actually a form of eXtensible Markup Language (XML), which allows developers to extend existing scripting languages and create new languages to fit their business needs. Let’s consider a sample XML document … Design | Development | Marketing
  • 24. <recipe xmlns=“http://www.foodnetwerk.com/recipe”<recipe xmlns=“http://www.foodnetwerk.com/recipe” lang=“en” xml:lang=“en”>lang=“en” xml:lang=“en”> <name>Head First Lounge Iced Tea</name><name>Head First Lounge Iced Tea</name> <description><description> A brisk iced tea with a bit of a kick ...A brisk iced tea with a bit of a kick ... </description></description> <ingredients><ingredients> <ingredient measurement=“6 cups”><ingredient measurement=“6 cups”> WaterWater </ingredient></ingredient> ...... </ingredients></ingredients> <preparation><preparation> <time duration=“10 minutes” /><time duration=“10 minutes” /> <step><step> Boil one cup of water in a pan, remove pan ...Boil one cup of water in a pan, remove pan ... </step></step> ...... </preparation></preparation> </recipe></recipe> Sample XML ScriptSample XML Script Design | Development | Marketing
  • 25. WHY MOVE TO XHTML? XHTML is more compatible with adaptive web software, like aural screen readers. The syntax is almost exactly like HTML; if you know how to write in HTML 4.01 Strict, the transition is almost seamless. In fact, XHTML is backwards compatible. XHTML is more compatible with mobile web agents like cell phones and PDAs. continued … Design | Development | Marketing
  • 26. WHY MOVE TO XHTML? Because XHTML is XML, you write new markup for it; there are already extensions to XHTML for vector graphics and mathematics. Any software that can read XML can read XHTML. Many large databases store data using XML; transitioning to XHTML will be easier than HTML. Since XHTML is XML, we reap the benefits of XML, including the ability to store large, structured documents. Design | Development | Marketing
  • 27. LET’S TRY ONE! Change the DOCTYPE declaration in lounge.html to the declaration below. DON’T run your page through the validator, just yet! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"> Design | Development | Marketing
  • 28. ALMOST THERE … Change the <html> element in lounge.html to add the attributes below. Then, run your page through the validator. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> Design | Development | Marketing
  • 29. CLOSING EMPTY TAGS We already know that any paired element contains two tags – an opening tag and a closing tag. XHTML, however, requires that you also close empty elements. To close an empty element (like <img> or <meta> use " />" at the end of the tag name, like this: <meta /> Update lounge.html and then validate … Design | Development | Marketing
  • 30. RULES FOR XHTML The <html> element must include xmlns, lang and xml:lang attributes. The <html> element must be the first tag after the DOCTYPE declaration. Write element names in lowercase. Close empty elements with a space and then a /, like this <tag />. continued … Design | Development | Marketing
  • 31. RULES FOR XHTML Enclose attribute values in double quotes, like this: <tag attribute = "value"> Attribute values must not be empty. Use entities in the place of the & character and other special characters. See the following URL for entity codes: http://www.w3schools.com/tags/ref_entities.asp Design | Development | Marketing
  • 32. TIPS FOR DEBUGGING Pay close attention to the line number the validator returns; don't stress over the exact error message. When the validator returns multiple errors, correct one error at a time, starting with the top error. Then, re-validate. Design | Development | Marketing