Re: XML tags are just a cheap rip-off of PHP tags

Jasper Bryant-Greene wrote:

>They're not really processing instructions, they just look like them so
>that editors and the like don't get confused.
>
>Whether you write it like that (which is inefficient anyway, because it
>drops in and out of PHP parsing mode) or just echo the whole tag, it's
>still invalid XML because it doesn't follow the correct processing
>instruction attr="val" structure like (<?xml version="1.0"
>encoding="utf-8"?>)
>  
>
There is no such requirement in XML that says the contents of a 
processing instruction have to be of attr="val" form...

[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

http://www.w3.org/TR/REC-xml/#sec-pi

I think it’s perfectly possible to use <?php ?> in a way that is legal 
to XML processors, as long as you don’t use it in attributes and avoid 
writing down the ‘?>’ sequence except when exiting the processing 
instruction (e.g. the echo then has to be echo '?'.'>', or using an 
escape code for the ? or the >). But the PHP parser also accepts it in 
places not legal to XML.

By the way, why is ‘dagobah1’ asking this on www-html and not on 
public-xml-core-wg or something? (although that one seems to miss a 
subscribe link in the W3C mailinglists overview).


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laurens Holst, student, university of Utrecht, the Netherlands.
Website: www.grauw.nl. Backbase employee; www.backbase.com.

Received on Friday, 24 June 2005 10:43:56 UTC