Jump to content

XML Declaration Problems


BenMillard

Recommended Posts

 

<?xml version="1.0" encoding="ISO-8859-1"?>

This is the thing I'm talking about, taken from Apache's website because they would probably know what they are doing. When I add this to the top of an XHTML 1.0 Strict web page, it works fine from my HDD in Firefox, IE6, etc. However, when I upload it to my web server and try to access it, it brings up an error.

 

 

Parse error: parse error, unexpected T_STRING in /home/ben/public_html/!dev/xml-declare.html on line 1
This is the error which is displayed. Obviously line 1 is the XML declare tag, so evidently there is something going wrong regarding it. I've seen plenty of other places include it without problems, so I don't understand why it doesn't like me. sad.gif

 

 

<?xml version="1.0" encoding="ISO-8859-1"?><!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" xml:lang="en-GB" lang="en-GB" dir="ltr"><head><title>SiteSurgeon</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

This is how the document in question begins. I save my web pages using standard ASCII which is what I thought ISO-8859-1 described. Any ideas?

Edited by Cerbera
Link to comment
Share on other sites

It looks like your server is treating the <? as a short PHP opening tag and trying to parse xml version="1.0" encoding="ISO-8859-1" as PHP code, which is obviously going to cause problems.

Link to comment
Share on other sites

It looks like your server is treating the <? as a short PHP opening tag and trying to parse xml version="1.0" encoding="ISO-8859-1" as PHP code, which is obviously going to cause problems.

As far as I know the server only interprets PHP if the file is saved as PHP - not HTML.

 

If i'm wrong, this may fix it (I use this on my PHP pages):

 

<?php echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; ?>

 

Just put that in the place of line 1.

I suppose you will need to save this as a PHP file though. meh, you can try it.

 

This might be of some assistance.

Link to comment
Share on other sites

Ooh, well spotted guys. When using Johnno's PHP workaround the page seems to operate correctly. Segosa suggested over MSN that including "XML" in the filename might have had an effect but it obviously doesn't.

 

 

segosa says:

  if it works, shout at your host for binding .html to php

Since this "binding" means my XML declaration will be longer than it need be because of the PHP workaround, I'll see if he can change the configuration. I've never gotten involved with server configuration beyond permanent redirects, lol. I'm slowly getting around to it, though.
Link to comment
Share on other sites

I made a topic at Accessify Forums got advice from there as well. So many helpful people on the Web! smile.gif

 

 

php_value short_open_tag Off

I tried out that in the .htaccess file as suggested by Segosa and it seems to have worked fine. Therefore I have updated SiteSurgeon with the XML declaration in all the pages. Cheers for the guidance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.