Re: Re: ? PHP in XML document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I went googling for XML validators and tried your sample in both forms, as 
you sugest with CDATA and my way:

 <root>
    <data><?php require_once("read_database.php"); ?></data>
 </root>

Both are valid.  The relevant paragraph can be found in:

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

Notice that while <?php is a valid start tag the shorthand <? is not since 
it is missing what the standard calls the Processing Instruction Target, or 
PITarget, for short.   This PITarget is the application that is supposed to 
understand this PI.  The XML standard says nothing about the contents and 
syntax of whatever is within the PI tags, only that it cannot contain a ?>

Satyam


"Torgny Bjers" <torgny@xxxxxxxxxxx> wrote in message 
news:430056C7.80600@xxxxxxxxxxxxxx
> Well, in this case, XML would care, since you'd be using a < or > inside
> a tag, so, in order for that to work, if what he meant was that he
> wanted to store PHP code directly inside the XML document, and not
> actually EXECUTE code INSIDE the XML file, he would have to use
> <![CDATA[bla]]> syntax around the PHP code for it not to break the XML 
> file.
>
> So, in this case that would be:
> <root>
>    <data><![CDATA[<?php require_once("read_database.php"); ?>]]></data>
> </root>
>
> Which works fine as long as he doesn't have ]]> somewhere in the code. :)
>
> Satyam wrote:
>
>>Whatever starts with <? immediatly followed by an identifier is called a
>>Processing Instruction, which ends with a ?>   XML doesn't care what is
>>within those tags, as long as it doesn't contain a ?>
>>
>>Satyam
>>
>>
>>
>>""Labunski"" <romans@xxxxxxxxx> wrote in message
>>news:31.DD.33075.C2700034@xxxxxxxxxxxxxxx
>>
>>
>>>Hello,
>>>
>>>Is it possible to write some PHP code lines in the XML document?
>>>
>>>e.g. I want to add <?php require_once("read_database.php"); ?> to the xml
>>>document, but
>>>I don't know the right syntax to do this.
>>>
>>>Btw, I need this, cause I'm trying to make CMS system for Flash page.
>>>
>>>Thanks a lot!
>>>Roman
>>>
>>>
>>
>>
>> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux