By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,857 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,857 IT Pros & Developers. It's quick & easy.

CSS validation fails, can you help me figuring out what's wrong?

P: n/a
Hi,

I'm using phpWebSite to build my website and I want it to be standard
conforming. However, the CSS validator always outputs an error:

"Please, validate your XML document first!
The processing instruction target matching "[xX][mM][lL]" is not allowed."

The offending line is:
<?xml version="1.0" encoding="iso-8859-1"?>

The site is built in XHTML, but the HTML validator says it would be
valid XHTML 1.0!

Any ideas?

--
Matthias Kaeppler
Aug 9 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Matthias Kaeppler wrote:
However, the CSS validator always outputs an error:

"Please, validate your XML document first!
The processing instruction target matching "[xX][mM][lL]" is not allowed."

The offending line is:
<?xml version="1.0" encoding="iso-8859-1"?>


As you did not provide a URL, just a guess: Is there anything preceding
the XML declaration? Newline? Comment?
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 9 '05 #2

P: n/a
Matthias Kaeppler wrote:

I'm using phpWebSite to build my website and I want it to be standard
conforming.


Good luck with that, you'll probably need it.

phpWebSite outputs a big mess of code, at least it did the last time I
gave it a spin. Lots of HTML style attributes mixed with inline styles
and external stylesheets. It's not very pretty.

Me thinks you'll have bigger fish to fry than passing validation.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Aug 9 '05 #3

P: n/a
Johannes Koch wrote:
As you did not provide a URL, just a guess: Is there anything preceding
the XML declaration? Newline? Comment?


That's right, this line is preceding the XML header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The document validates just fine on this DTD, but CSS doesn't, it won't
go past the XML version declaration.

--
Matthias Kaeppler
Aug 10 '05 #4

P: n/a
Matthias Kaeppler wrote:
That's right, this line is preceding the XML header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Change the sequence:
1. XML declaration
2. Document type declaration.
The document validates just fine on this DTD,


That's because the W3C markup validator does not really know about XHTML
and XML in general.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 10 '05 #5

P: n/a
Johannes Koch wrote:
That's because the W3C markup validator does not really know about XHTML
and XML in general.


Nor should it (in general).

The web is not (yet) an XML medium. If you want to serve XHTML (don't
let me stop you) then you're best doing it as text/html under Appendix
C. This is perfectly reasonable to do and works fine.

However a validator encountering such a page has to treat it as an SGML
document (or an least non-XML HTML, where this varies from rigid SGML)
conforming to some mutant SGML DTD derived from the XHTML Schema. It
would be an error to treat it as an XML document and try to validate it
against XML rules, because that's not what you're serving it as.

Yes, the W3C validator doesn't do XML. If you serve XHTML _as_ XML
(with application/xhtml+xml) then you're going to see odd behaviours -
much as you may if you serve it like that to the web at large. In
particular, don't expect the W3C validator to validate it _as_ an XML
document - features like namespaces (for instance) just don't work.

This is not entirely unreasonable though. The W3C validator never
claims to be an XML validator, nor is (and this surprises many people)
an XHTML document an XML document, _if_it's_served_as_HTML_. Your
embedded RDF metadata with namespaces (and I'm the biggest culprit
around) is fine and dandy so long as your XHTML document still _is_
XML, but once you throw it out onto the web wearing the trousers of
HTML, then that namespacing is no longer valid. We know the old HTML
rules about ignoring unknown elements and just rendering their content
- these are enough to keep the embedded metadata "safe" for use
(there's an old last-century "RDF in HTML" note of Dan Brickley's on
just this topic) but while this "safe" "extended" HTML is perfectly
usable, it is no longer valid in the strict sense.

Aug 10 '05 #6

P: n/a
"Matthias Kaeppler" <no****@digitalraid.com> schreef in bericht
news:dd*************@news.t-online.com...
Hi,

I'm using phpWebSite to build my website and I want it to be standard
conforming. However, the CSS validator always outputs an error:

"Please, validate your XML document first!
The processing instruction target matching "[xX][mM][lL]" is not allowed."

The offending line is:
="1.0" encoding="iso-8859-1"?>

Delete the line, it fucks up your xhtml/css markup. Or, like Jeffrey Zeldman
puts it:
"Unfortunately, many browsers, even from 'nice' homes, can't handle their
XML prolog. After imbibing this XML element they stagger and stumble and
soil themselves, bringing shame to their families and eventually losing
place in society"
LOL

--
Niek
Aug 10 '05 #7

P: n/a
di*****@codesmiths.com wrote:
However a validator encountering such a page has to treat it as an SGML
document (or an least non-XML HTML, where this varies from rigid SGML)
conforming to some mutant SGML DTD derived from the XHTML Schema. It
would be an error to treat it as an XML document and try to validate it
against XML rules, because that's not what you're serving it as.
I see your point. But IMHO, a validating tool is not a general HTTP user
agent. I would prefer to have at least an option to validate an XHTML
document against XML rules because XHTML is an XML-based language,
regardless of the MIME type the document is sent with.
Your
embedded RDF metadata with namespaces


BTW, I'm not the OP.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 10 '05 #8

P: n/a
On Thu, 11 Aug 2005 00:33:43 +0200, Johannes Koch
<ko**@w3development.de> wrote:
I see your point. But IMHO, a validating tool is not a general HTTP user
agent.
Agreed, although in general it ought to emulate the behaviour of one. A
tool that works differently would be misleading, and that's a bad thing.
I would prefer to have at least an option to validate an XHTML
document against XML rules
Again, agreed. One day we'll probably have one.

As it's an easier problem to solve, I already have several XML
validators that can happily validate my XHTML documents (today I'm
using XMLSpy, although I can't claim to like it)
because XHTML is an XML-based language,
regardless of the MIME type the document is sent with.


I disagree - as stated above. "based" is possible, but in the sense of
"acts as an example of" it's no longer true in the text/html case.
Your
embedded RDF metadata with namespaces


BTW, I'm not the OP.


I was speaking generally. Sometimes it feels as if I'm the only person
who embeds metadata in HTML.

Aug 10 '05 #9

P: n/a
> On Thu, 11 Aug 2005 00:33:43 +0200, Johannes Koch
<ko**@w3development.de> wrote:
I see your point. But IMHO, a validating tool is not a general HTTP user
agent.

Andy Dingley wrote: Agreed, although in general it ought to emulate the behaviour of one. A
tool that works differently would be misleading, and that's a bad thing.


Think of validating documents that are not sent via HTTP.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 11 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.