Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic XML File Problem

Status
Not open for further replies.

ralphiooo

Programmer
Oct 23, 2005
64
GB
Hi, i'm trying to create a google site map, i added AddType application/x-httpd-php .xml to my htaccess file and then put the following at the top of the siteindex.xml file:

<?xml version="1.0" encoding="UTF-8"?>

but it returns a parse error. I think it's the <? at the start but can't find a solution.

Appreciate if someone could help. Thanks
 
It should work if you echo out the declaration:
Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
 
Or make sure that short_open_tag is set to "off" in php.ini and use longer "<?php" to denote the beginning of a block of code.


Want the best answers? Ask the best questions! TANSTAAFL!
 
i added AddType application/x-httpd-php .xml to my htaccess file

Why would you want to force PHP to process XML files? If you're going to process the XML with PHP, use the simplexml extension (if you've got PHP5+) ... or the expat parser with lesser versions.

But vragabond is right; normally the <? is used to denote the start of a PHP code block; when you used the <? to start the XML declaration, the PHP parser figured it was supposed to interpret some code, and obviously failed. :)

Greg

"for me, the action is the juice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top