W3C home > Mailing lists > Public > www-validator@w3.org > July 2010

Re: Validator fails on PHP instructions inside attribute values

From: Dag-Erling Smørgrav <des@des.no>
Date: Tue, 20 Jul 2010 11:46:55 +0200
To: "Richard Ishida" <ishida@w3.org>
Cc: "'David Dorward'" <david@dorward.me.uk>, <www-validator@w3.org>
Message-ID: <86vd8alc34.fsf@ds4.des.no>
"Richard Ishida" <ishida@w3.org> writes:
> I'm beginning to understand that the processing instruction thing is
> clouding the issue, since php code is not inside processing
> instructions.  

Not entirely correct.  PHP uses the <? ... ?> syntax to hide from XML
validators so you can run your templates through, say, xmllint without
having to run the application.  Of course, it only works in simple
cases.

> So I suppose that what I really want is a pre-processor that goes
> through my code and removes everything between <?php ... ?> (taking
> care obviously to avoid literal strings containing such delimiters),
> before the validation starts.  

Feel free to write one (it should only take a few lines of Perl) and run
it on your code before submitting it to the validator, but it's not
really a good idea, because the code you validate will not be the same
as what the user's browser sees.

DES
-- 
Dag-Erling Smørgrav - des@des.no
Received on Tuesday, 20 July 2010 09:49:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:43 GMT