W3C complience checker and conformance

M

Mark Parnell

Deciding to do something for the good of humanity, ironcorona
Really? But they're empty!

Not in XHTML. XML has no concept of empty elements.
Is there an </img> tag too?
Absolutely.

http://www.w3.org/TR/xhtml1/#guidelines
Just looked it up. You can do it because its part of XML but W3C seems
to be saying not to use it if at all possible.

Because older browsers (including IE) don't support it and will barf on
it.

Better to just use HTML in the first place.
 
M

Mark Parnell

Deciding to do something for the good of humanity, EN
W3C says that
<link> tags should not be closed by /> (empty tag) nor by </link> so a <link
[tags]> should stay as it is.

instead it wants a <meta> tag to be closed by </meta> and not by /> (empty
tag)

That doesn't make sense. What is the URL, and what "checker" are you
using?
 
I

ironcorona

Mark said:
Deciding to do something for the good of humanity, ironcorona


Not in XHTML. XML has no concept of empty elements.


Because older browsers (including IE) don't support it and will barf on
it.

Better to just use HTML in the first place.


....The plot thickens!
 
S

Spartanicus

Mark Parnell said:
Not in XHTML. XML has no concept of empty elements.

XHTML is merely a reformulation of HTML in XML, what is defined as an
empty element in HTML remains an empty element in XHTML.
Absolutely.

A limitation of XML is that a validator won't detect it, but there is no
such tag in XHTML.
Because older browsers (including IE) don't support it and will barf on
it.

Using a closing tag for empty elements with no content turns an element
in to a non empty element with null content. Like validators XHTML
renders won't choke on that, but it's incorrect XHTML.
 
M

Mark Parnell

Deciding to do something for the good of humanity, Spartanicus
XHTML is merely a reformulation of HTML in XML, what is defined as an
empty element in HTML remains an empty element in XHTML.

Ick, did I really say that? What I meant was that XHTML requires all
elements to be closed, even if they are empty.
Using a closing tag for empty elements with no content turns an element
in to a non empty element with null content. Like validators XHTML
renders won't choke on that, but it's incorrect XHTML.

Either is valid according to the XML and XHTML specs. It's not
*recommended* to use a closing tag, but it's still valid.

"The representation of an empty element is either a start-tag
immediately followed by an end-tag, or an empty-element tag."
http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-starttags

"Empty elements must either have an end tag or the start tag must end
with />"
http://www.w3.org/TR/xhtml1/#h-4.6

Incidentally, the XML spec (see link above) defines elements without any
content "empty", regardless of whether they are defined as EMPTY in the
DTD.
 
I

ironcorona

Spartanicus said:
XHTML is merely a reformulation of HTML in XML, what is defined as an
empty element in HTML remains an empty element in XHTML.

But if XML doesn't have empty tags, as the previous poster said, then
how can XHTML have empty tags since XHTML is a subset of XML (where the
DTD defines how the browser (or whatever) should deal with certain tags,
in a standardised way)?

As we can see here:
http://www.w3.org/TR/xhtml1/#xhtml

"XHTML documents are XML conforming. As such, they are readily viewed,
edited, and validated with standard XML tools"

Of course the fact is that there *are* empty tags in XHTML but how are
these defined?
Absolutely.

A limitation of XML is that a validator won't detect it, but there is no
such tag in XHTML.
[...]

Using a closing tag for empty elements with no content turns an element
in to a non empty element with null content. Like validators XHTML
renders won't choke on that, but it's incorrect XHTML.

http://www.w3.org/TR/xhtml1/#h-4.6

says there it's fine.
But as I said the compatibility guidelines say that you really shouldn't
be using it.
 
I

ironcorona

Mark said:
Deciding to do something for the good of humanity, Spartanicus


Ick, did I really say that? What I meant was that XHTML requires all
elements to be closed, even if they are empty.

So XML *does* have the concept of empty elements?

Actually, I'm off to http://www.doyourowndamnresearch.com
Then I can come back and pretend I knew all along

:)
 
D

David Dorward

Really? But they're empty! Is there an </img> tag too?

Yes. All elements in XHTML must be explicitly closed.
http://www.w3.org/TR/xhtml1/#guidelines
Just looked it up. You can do it because its part of XML but W3C seems
to be saying not to use it if at all possible.

In an XHTML document it is fine, however XHTML documents served as text/html
have additional restrictions to reduce the number of problems they cause to
browsers which are designed for handing HTML.
 
I

ironcorona

ironcorona said:
But if XML doesn't have empty tags, as the previous poster said, then
how can XHTML have empty tags since XHTML is a subset of XML (where the
DTD defines how the browser (or whatever) should deal with certain tags,
in a standardised way)?

Never mind. I just looked it up.
 
D

David Dorward

ironcorona said:
But if XML doesn't have empty tags

It does:

Of course the fact is that there *are* empty tags in XHTML but how are
these defined?

Pretty much the same way as HTML - but without the "Start tag required, End
tag forbidden" code:

<!ELEMENT IMG - O EMPTY -- Embedded image -->
-- http://www.w3.org/TR/html4/sgml/dtd.html#Pixels

http://www.w3.org/TR/xhtml1/#h-4.6
says there it's fine.
But as I said the compatibility guidelines say that you really shouldn't
be using it.

IF you are serving the document as text/html.
 
I

ironcorona

David said:
In an XHTML document it is fine, however XHTML documents served as text/html
have additional restrictions to reduce the number of problems they cause to
browsers which are designed for handing HTML.

So THAT'S what that's about. I've just noticed recently that the W3
validator is insisting on a character encoding declaration. Something like:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
in order for it to be strict XHTML.

It's all making sense now.
 
M

Mark Parnell

Deciding to do something for the good of humanity, ironcorona
As a by the way: what are the other options? is there a text/xhtml?

application/xml+xhtml
 
S

Spartanicus

Mark Parnell said:
Either is valid according to the XML and XHTML specs. It's not
*recommended* to use a closing tag, but it's still valid.

It is valid, but DTD validation has it's limitations, even more so for
XHTML, this is one of those limitations.
"The representation of an empty element is either a start-tag
immediately followed by an end-tag, or an empty-element tag."
http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-starttags

"Empty elements must either have an end tag or the start tag must end
with />"
http://www.w3.org/TR/xhtml1/#h-4.6

Incidentally, the XML spec (see link above) defines elements without any
content "empty", regardless of whether they are defined as EMPTY in the
DTD.

XHTML does not equal XML.
 
M

Mark Parnell

Deciding to do something for the good of humanity, Spartanicus
It is valid, but DTD validation has it's limitations, even more so for
XHTML, this is one of those limitations.

So would you care to show some sort of reference as to why it is
"incorrect XHTML" to use a closing tag on an empty element, since the
part of the specs I quoted says that it *is* correct?
XHTML does not equal XML.

I never said it did.
 
D

David Dorward

ironcorona said:
So THAT'S what that's about. I've just noticed recently that the W3
validator is insisting on a character encoding declaration. Something
like: <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" /> in order for it to be strict XHTML.

That is very much a poor mans solution, and prevents you serving the
document as application/xhtml+xml - http://www.w3.org/TR/xhtml1/#C_9 - a
real HTTP header is the better way.
 
D

David Dorward

It is valid, but DTD validation has it's limitations, even more so for
XHTML, this is one of those limitations.

Yes, but Appendix C requirements aren't requirements for conformant XHTML,
just XHTML pretending to be HTML.
XHTML does not equal XML.

If you have an XHTML document, then it IS also an XML document (the reverse
may not be true).
 
D

David Dorward

Mark said:
Deciding to do something for the good of humanity, Spartanicus


So would you care to show some sort of reference as to why it is
"incorrect XHTML" to use a closing tag on an empty element, since the
part of the specs I quoted says that it *is* correct?

Empty-element tags MAY be used for any element which has no content,
whether or not it is declared using the keyword EMPTY. For
interoperability, the empty-element tag SHOULD be used, and SHOULD only
be used, for elements which are declared EMPTY.

http://www.w3.org/TR/2004/REC-xml-20040204/#IDAJ13S

Which is news to me, and something that a lot of tools seem to get wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top