PDA

View Full Version : Who's right?



oldcrazylegs
Mar 12th, 2008, 10:10 PM
W3schools says the following is correct.


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

Tidy says this correct. It says xml:lang="en" should only be used in XML documents.


<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

Who's right?

VIPStephan
Mar 12th, 2008, 10:20 PM
Well, theoretically, the xmlns attribute is only used in XML documents anyway (declaring a section in the XML document where the XHTML namespace is used) so using xml:lang is the only right choice, and lang should be abolished. It has only been common practice to still use the regular lang attribute for browsers that might not support xml:lang.

oldcrazylegs
Mar 12th, 2008, 10:23 PM
So you're saying I should just ignore Tidy and put up with the error/warning it gives me?

oldcrazylegs
Mar 12th, 2008, 10:31 PM
Something else bugs me too. W3Schools says that the Doctype should be the first line in your source code. But on the Valid DTD-List page at W3 it shows an XML Prolog as the first line of code. Too many people with different views confuse everyone. Someone needs to wake them up.

Using the XML Prolog in IE6 seems to put it in the quirks mode since IE6 requires the Doctype to be on top.

The page validates either way I do it. But If I'm going to do this I want to know the correct way.

I went to your site. You do nice work. :)

oesxyl
Mar 12th, 2008, 10:43 PM
Something else bugs me too. W3Schools says that the Doctype should be the first line in your source code. But on the Valid DTD-List page at W3 it shows an XML Prolog as the first line of code. Too many people with different views confuse everyone. Someone needs to wake them up.

The page validates either way I do it. But If I'm going to do this I want to know the correct way.

there are no different views, are different contexts. If you don't have a doctype, it's a guess what kind of markup you use so each one interpret what it guess you want?
also the xml prolog is optional but if you have it must be first.
tidy have some option for input, in case you want to intrepret it as you want and not let him guess, try it.
another thing is that if I must make a choice between tidy and w3school, I 'm with tidy, :)

best regards

VIPStephan
Mar 12th, 2008, 10:53 PM
The XML prolog is, as the name implies, used to initiate an XML document. However, most XHTML websites are currently not actually XML (MIME type application/xhtml+xml) but still served as HTML (MIME type text/html), so the XML prolog is optional if the latter one is the case.

Internet Explorer doesn’t interpret true XHTML yet, and that’s why it’s sent as HTML. And to make things worse, if anything (the XML prolog included) comes before the doctype it’s switching into quirks mode and doesn’t render documents properly.

The XML prolog is valid but it’s not yet feasible to have it if you care for IE(6) users so the W3C left the option to leave it out without making the document invalid.

oldcrazylegs
Mar 12th, 2008, 10:58 PM
I was thinking the same thing. I'm with Tidy too. But I wondered what everyone else thought about it. Thanks.

I am using TidyGUI which I don't think has been updated since it was created in 2000. So I wasn't sure whether to trust it or not.

http://pagesperso-orange.fr/ablavier/TidyGUI/help/index.html

What do you guys use to validate when you are offline?

Thanks for both answers. I'm almost not confused now. Just Kidding. :)

oesxyl
Mar 12th, 2008, 11:46 PM
I was thinking the same thing. I'm with Tidy too. But I wondered what everyone else thought about it. Thanks.

I am using TidyGUI which I don't think has been updated since it was created in 2000. So I wasn't sure whether to trust it or not.

http://pagesperso-orange.fr/ablavier/TidyGUI/help/index.html

I admire Dave Raggetts, I can say that I learn css from him, but it use to don't close p tags, :)
I don't know this interface, I use the comand line, but it seems to have all the option implemented in the configuration:

http://pagesperso-orange.fr/ablavier/TidyGUI/help/index.html#config

tidy is an euristic tool, could be configured to recognise tags what don't exist, :)
I don't think that tidy is a good as validator, I use it more to recover broken pages or for conversion but not as validator, I don't trust it.



What do you guys use to validate when you are offline?


well, this is a problem, :) First because we use different os, I'm on linux, and I don't know what and how work on windows.
Second because I use the online validators, w3c service with help of the webdeveloper extension, probably you have it instaled.
Some years ago I used, offline, the wdg validator but I don't know if it works with something else the html.

best regards

oldcrazylegs
Mar 13th, 2008, 01:08 AM
Yes I have the Webdeveloper Toolbar too. But W3C Validator doesn't work offline. Too bad they don't have an app you can download to use offline. I have no clue how to use command line apps. I need a GUI.

oesxyl
Mar 13th, 2008, 01:26 AM
Yes I have the Webdeveloper Toolbar too. But W3C Validator doesn't work offline. Too bad they don't have an app you can download to use offline. I have no clue how to use command line apps. I need a GUI.

I really don't know how this works, but maybe you want to take a look and maybe you find what you need.

http://www.w3.org/QA/Tools/

look at the bottom of the page:

Check each project for instructions on how to download their source code, and install them on your system

I find this now because I search for a offline html validator, I know that w3c validator can be run offline but I never use it.

command line is not such a big deal, :)

best regards

rafiki
Mar 13th, 2008, 01:39 AM
CSS: http://jigsaw.w3.org/css-validator/DOWNLOAD.html
Xhtml cant find one on there site

oesxyl
Mar 13th, 2008, 01:49 AM
CSS: http://jigsaw.w3.org/css-validator/DOWNLOAD.html
Xhtml cant find one on there site
I'm afraid you have a problem, it works for me, :)
this is the page content:
but I think you make a wrong choice, this tool I guess need a tomcat server, :)



<?xml version="1.0" encoding="utf-8"?>
<!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>Download and Install the CSS Validator</title>
<link rev="made" href="mailto:[email protected]" />
<link rev="start" href="./" title="Home Page" />
<style type="text/css" media="all">
@import "style/base.css";
@import "style/docs.css";
</style>
<meta name="revision"
content="$Id: DOWNLOAD.html.en,v 1.20 2008/02/29 13:26:12 ot Exp $" />
<!-- SSI Template Version: $Id: DOWNLOAD.html.en,v 1.20 2008/02/29 13:26:12 ot Exp $ -->

</head>

<body>
<div id="banner">
<h1 id="title"><a href="http://www.w3.org/"><img alt="W3C" width="110" height="61" id="logo" src="./images/w3c.png" /></a>
<a href="./"><span>CSS Validation Service</span></a></h1>
<p id="tagline">
Check Cascading Style Sheets (CSS) and (X)HTML documents with style sheets
</p>
</div>

<div class="doc">
<h2>Download and Install the CSS Validator</h2>
<h3 id="download">Download the CSS Validator</h3>

<h4 id="source">Download the source</h4>
<p>
The <a href='http://dev.w3.org/cvsweb/2002/css-validator'>CSS validator</a> is available for download using CVS.
Follow the <a href='http://dev.w3.org/cvsweb/'>instructions</a> to
access the W3C CVS public server and get 2002/css-validator. Note
that the online version of the CSS Validator is generally older than the CVS
version so results and appearance may vary slightly...
</p>
<h4>Download as java package (jar or war)</h4>

<!-- <p>TBD... we just need a stable location to put jar/war archives on a regular basis</p>-->
<p><a href="http://www.w3.org/QA/Tools/css-validator/css-validator.jar">css-validator.jar</a></p>


<h3>Installation guide</h3>
<p>The CSS validation service is a servlet software, written in Java. It may be installed on any servlet engine,
and can also be used as a simple command-line tool.
The official W3C CSS Validation service is running with the Jigsaw server, which is the recommended setup.
However, for the sake of simplicity, we will, in this document, mostly provide details on how to install
it as an online servlet with Apache's servlet engine Tomcat.</p>

<p>Some instructions on installing the servlet with Jigsaw, as well as running it from a command-line environment,
are also given below. </p>

<h4 id="prereq">Prerequisites</h4>

<p>This installation guide assumes that you have downloaded, installed and tested: </p>
<ul class="instructions">
<li>A working java environment,</li>
<li>The <a href="http://ant.apache.org/">Ant</a> java building tool</li>
<li>A java Web servlet container such as
<a href="http://www.w3.org/Jigsaw/">Jigsaw</a>, <a href="http://tomcat.apache.org/">Tomcat</a> or
<a href="http://www.mortbay.org/">Jetty</a> if you plan on using the validator as an online service.
This guide only covers Tomcat and Jigsaw in details.</li>

</ul>
<p id="prereq-libs">For the installation of the validator onto your system, you will
need to download and/or find in your system a number of java libraries:</p>
<ul class="instructions">
<li>servlet.jar
(which, if you have Tomcat installed in [<span class="const">TOMCAT_DIR</span>],
you should find in [<span class="const">TOMCAT_DIR</span>]/common/lib/) possibly
under the name servlet-api.jar. If not, get it at
<a href="http://java.sun.com/products/servlet/download.html">java.sun.com</a></li>
<li><a href="http://jigsaw.w3.org/Devel/classes-2.2/20060329/">jigsaw.jar</a></li>
<li>xercesImpl.jar and xml-apis.jar (which can be downloaded with
<a href="http://www.apache.org/dist/xml/xerces-j/">xerces-j-bin</a>).</li>

<li><a href="http://ccil.org/~cowan/XML/tagsoup/">tagsoup.jar</a></li>
</ul>

<h4>Install the CSS Validator with Tomcat</h4>
<ol class="instructions">
<li>
Download validator as explained <a href="#source">above</a>.
</li>
<li>Copy the whole source folder ("<span class="dir">.../css-validator/</span>") to the <span class="dir">webapps</span>

directory within your installation of Tomcat. usually, this will be
<span class="dir">[<span class="const">TOMCAT_DIR</span>]/webapps/</span>.
The Validator's sources are now in <span class="dir">[<span class="const">TOMCAT_DIR</span>]/webapps/css-validator</span>,
which we will now call <span class="dir">[<span class="const">VALIDATOR_DIR</span>]</span>.
</li>
<li>In "<span class="dir">[<span class="const">VALIDATOR_DIR</span>]</span>" create a directory "<span class="dir">WEB-INF</span>", and In "<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/WEB-INF</span>" create a directory "<span class="dir">lib</span>":<br />

<kbd>mkdir -p WEB-INF/lib</kbd>
</li>
<li>Copy all the jar files (from the <a href="#prereq-libs">prerequisites</a>) to the directory "<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/WEB-INF/lib</span>"</li>
<li>Compile the validator's source: from the directory <span class="dir">[<span class="const">VALIDATOR_DIR</span>]</span>,
Run <kbd>ant</kbd>, while making sure that the jar files you downloaded are correctly set in you CLASSPATH environment variable.
Generally, the following will just work:<br />

<kbd>CLASSPATH=.:./WEB-INF/lib:$CLASSPATH ant</kbd>
</li>
<li>Copy or move "<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/</span><span class="file">css-validator.jar</span>"
to "<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/WEB-INF/lib/</span>".</li>

<li>
Copy or move file "<span class="file">web.xml</span>" from
"<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/</span>" to
"<span class="dir">[<span class="const">VALIDATOR_DIR</span>]/WEB-INF/</span>".
</li>
<li>

Finally, reload the Tomcat server:<br />
<kbd>"cd <span class="dir">[<span class="const">TOMCAT_DIR</span>]</span>; <span class="dir">./bin/</span><span class="file">shutdown.sh</span>; <span class="dir">./bin/</span><span class="file">startup.sh</span>;"</kbd>
</li>

</ol>

<h4>Install on Jigsaw Web Server</h4>
<ol class="instructions">
<li>First, download the source as described above, get the necessary jars, and build the source with <kbd>ant</kbd>.</li>

<li>Then you have to configure the validator home directory (usually this is
css-validator) so that it can work as a servlet container. For this purpose
you need to have Jigsaw installed (see the Jigsaw pages for a short
instruction (it is really easy)) and then start Jigsaw Admin. Change the
HTTPFrame to ServletDirectoryFrame.</li>

<li>The next step is to create a resource "validator", with as class
'ServletWrapper' and as frame 'ServletWrapperFrame'. The latter should add
itself automagically. The class of the servlet is
org.w3c.css.servlet.CssValidator. If there already exists a file named
'validator', please rename it. It is important that this 'alias' is always
named 'validator'.</li>

<li>Finally, start Jigsaw and run the validator. Check which HTML you want to
invoke. Usually your URL will look like this:<br />

http://localhost:8001/css-validator/validator.html</li>
</ol>

<h3>Command-line usage</h3>

<p>The CSS validator can also be used as a command-line tool, if your computer
has java installed. build the css-validator.jar as explained above, and run as:<br />
<kbd>java -jar css-validator.jar http://www.w3.org/</kbd>
</p>
</div>
<ul class="navbar" id="menu">
<li><strong><a href="./" title="Home page for the W3C CSS Validation Service">Home</a></strong> <span class="hideme">|</span></li>

<li><a href="about.html" title="About this service">About</a> <span class="hideme">|</span></li>

<li><a href="documentation.html" title="Documentation for the W3C CSS Validation Service">Documentation</a> <span class="hideme">|</span></li>
<li><a href="Email.html" title="How to provide feedback on this service">Feedback</a> <span class="hideme">|</span></li>
<li><a href="thanks.html" title="Credits and Acknowlegments">Credits</a><span class="hideme">|</span></li>

</ul>

<ul id="lang_choice">
<li><a href="DOWNLOAD.html.de"
lang="de"
xml:lang="de"
hreflang="de"
rel="alternate">Deutsch</a></li>
<li><a href="DOWNLOAD.html.en"
lang="en"
xml:lang="en"
hreflang="en"
rel="alternate">English</a> </li>
<li><a href="DOWNLOAD.html.es"
lang="es" xml:lang="es" hreflang="es"
rel="alternate">Espa˝ol</a></li>
<li><a href="DOWNLOAD.html.fr"
lang="fr"
xml:lang="fr"
hreflang="fr"
rel="alternate">Franšais</a> </li>

<li><a href="DOWNLOAD.html.it"
lang="it"
xml:lang="it"
hreflang="it"
rel="alternate">Italiano</a> </li>
<li><a href="DOWNLOAD.html.nl"
lang="nl"
xml:lang="nl"
hreflang="nl"
rel="alternate">Nederlands</a> </li>
<li><a href="DOWNLOAD.html.ja"
lang="ja"
xml:lang="ja"
hreflang="ja"
rel="alternate">日本語</a> </li>
<li><a href="DOWNLOAD.html.pl-PL"
lang="pl"
xml:lang="pl"
hreflang="pl"
rel="alternate">Polski</a> </li>
<li><a href="DOWNLOAD.html.zh-cn"
lang="zh-hans"
xml:lang="zh-hans"
hreflang="zh-hans"
rel="alternate">简体中文</a></li>

</ul>


<div id="footer">
<p id="activity_logos">

<a href="http://www.w3.org/QA/" title="W3C's Quality Assurance Activity, bringing you free Web quality tools and more"><img src="http://www.w3.org/QA/2002/12/qa-small.png" alt="QA" /></a><a href="http://www.w3.org/Style/CSS/learning" title="Learn more about Cascading Style Sheets"><img src="images/woolly-icon" alt="CSS" /></a>
</p>

<p id="support_logo">
Support this tool, become a<br />

<a href="http://www.w3.org/Consortium/supporters"><img src="http://www.w3.org/Consortium/supporter-logos/csupporter.png" alt="W3C Supporter" /></a>
</p>

<p class="copyright">
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &copy; 1994-2007
<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a>&reg;

(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>),
All Rights Reserved.
W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>

and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a>

rules apply. Your interactions with this site are in accordance
with our <a href="http://www.w3.org/Consortium/Legal/privacy-statement#Public">public</a> and
<a href="http://www.w3.org/Consortium/Legal/privacy-statement#Members">Member</a> privacy
statements.
</p>

</div>

</body>

</html>


best regards

Skyzyx
Mar 13th, 2008, 02:37 AM
It's unfortunate, but XHTML on the web is flawed -- primarily because it conflicts with current state of the real-world.

In XML documents (as well as XHTML documents served as application/xml+xhtml), the first line should be the XML prologue. In HTML documents (including XHTML documents served as text/html), it should be the DOCTYPE. All currently released "stable" builds of Internet Explorer (including IE8b1) have problems with application/xml+xhtml. I know that IE6 also has issues with the XML prologue snapping the browser into Quirks Mode, but I don't recall if that was fixed in IE7 or not.

As far as this particular question about this particular attribute, I'd say to go with Tidy over W3Schools, but in general, I'd say to build with validated HTML 4.01 Strict instead (because the last time I checked, HTML 4.01 was still a standard :thumbsup:).

liorean
Mar 13th, 2008, 03:46 AM
Actually:

If the document is served as HTML:
- For compatibility with ie6, there should be nothing before the DOCTYPE.
- The DOCTYPE is only there for two things: The validator, and putting your document in Almost Standards or Standards mode instead of Quirks.
- The xmlns="http://www.w3.org/1999/xhtml" attribute and xml:lang attribute are ignored, lang attribute is not.
- The first thing inside the head element should be a <meta http-equiv="Content-Type" content="text/html; charset=encoding"> element where encoding is the only important part.


If the document is served as XML:
- The XML declaration is optional, EXCEPT in the case of the encoding being anything other than UTF-8 or UTF-16 while the encoding is not declared in the HTTP headers. US-ASCII is a strict subset of UTF-8 though and can safely be treated as UTF-8.
- There may be an arbitrary number of comments or whitespace after the optional XML declaration, before the optional DOCTYPE.
- The DOCTYPE is only needed for validation. Nothing else cares.
- There may be an arbitrary number of comments or whitespace after the optional DOCTYPE, before the obligatory document root element.
- All XHTML elements must be in the "http://www.w3.org/1999/xhtml" namespace, using either default namespaces or a namespace qualifier.


If the document is served as XHTML:
- Everything that would be required if the document was served as XML.
- The root element must be html and must have the xmlns="http://www.w3.org/1999/xhtml" attribute. The root element should but is not required to declare an xml:lang attribute. For compatibility with HTML4.01, it may also include a lang attribute, though that attribute is ignored in XHTML.

Skyzyx
Mar 13th, 2008, 03:56 AM
In XML documents (as well as XHTML documents served as application/xml+xhtml), the first line should be the XML prologue.

If the document is served as XML:
- The XML declaration is optional, EXCEPT in the case of the encoding being anything other than UTF-8 or UTF-16 while the encoding is not declared in the HTTP headers. US-ASCII is a strict subset of UTF-8 though and can safely be treated as UTF-8.

I didn't definitively know that the XML prologue was optional, but you still want to avoid it when working with XHTML and IE because IE will snap back into Quirks Mode (the closer you fit the standard, the further IE goes...). Mark Pilgrim's summary of RFC 3023 goes over the rules for fallback character sets for XML in better detail.

http://diveintomark.org/archives/2004/02/13/xml-media-types

liorean
Mar 13th, 2008, 04:59 AM
I didn't definitively know that the XML prologue was optional, but you still want to avoid it when working with XHTML and IE because IE will snap back into Quirks Mode (the closer you fit the standard, the further IE goes...). Mark Pilgrim's summary of RFC 3023 goes over the rules for fallback character sets for XML in better detail.

http://diveintomark.org/archives/2004/02/13/xml-media-typesOr you could just look at this flowchart:
http://nikitathespider.com/articles/EncodingDivinationFlowchart.png