is it possible to put PHP code inside a XML document to be later executed? For example, can I say
To force your webserver to execute PHP inside XML files, change the MIME type of .xml-files to application/x-httpd-php, by adding this line to .htaccess:
AddType application/x-httpd-php .xml
Now all XML files are treated by the webserver the same way as PHP files:
Note that the header-definition is there to correct the MIME type of your file back to application/xml. Otherwise it would be treated by the browser as HTML, preventing it from displaying a nice DOM tree (or whatever the default XML handling may be...). Even if the file is not intended to be opened in a browser, it's never nice to fake the MIME type of a file, so please don't forget this line ;)
The drawback of this solution: Now all XML files in the access range of your .htaccess will be treated as php, so you'd have to change the MIME-type of any XML file in the same folder via PHP. Workaround: Move your php-hacked XML and the .htaccess to a separate folder.