Andy Hassall wrote:
On 10 Aug 2005 15:04:38 -0700, Will Woodhull wrote:
Andy Hassall wrote: You wouldn't run PHP source through an XML validator in the first
place.
It is easier to validate a complex XHTML template with embedded PHP as
a .html page-- so there are times when it makes sense to run PHP source
through a validator.
Hm, I still don't see why you'd pass the SOURCE through an XML validator.
You pass the OUTPUT through a validator; sure.
Surely you're not going to get very far trying to write XML-validated PHP
source code; kinda rules out using "&&" ... unless you start jumping through
hoops with CDATA or something. Then again I don't know enough about how an
XML validator would react to the contents of a <?php ?> processing
instruction.
As I said earlier, I don't know about XML validation-- I'll see about
that when I get there.
With XHTML, so far my experience has been that code within the <?php
.... ?> tag is ignored by the validators. Just to be clear, I'm talking
about validating stuff like
<!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" lang="en">
<head>
<title><?php echo $_SESSION[spreadsheet][title] ?></title>
<script type="text/javascript">
<!--
<?php
echo <<<EOHere
// functions providing spreadsheet capabilities and
EOHere;
// load initial spreadsheet values
echo $_SESSION[spreadsheet][javascriptVaria bles];
?>
// -->
</script>
</head>
<body onload="LoadDat aToSpreadsheet( )">
<div id="spreadsheet ">
<!-- a complicated spreadsheet-like structure
with lots of "cells" -->
</div>
<form>
<!-- front end providing spreadsheet interface -->
</form>
</body>
</html>
A template like this can be complex enough that it makes sense to
validate it independently of the stuff that the PHP script will add.