SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast HappyPike's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question White space preceding XML declaration

    In my PHP layout I have a XML declaration in the first line. But for some reason everytime I validate the page I get a "White space preceding XML declaration" warning. Here is what I have in the first few lines:

    PHP Code:
    <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    How can I get rid of that whitespace warning?

    Thanks in advance.

    PS: I have to put the declaration inside PHP tag because using "<?xml version= " in php file directly was giving me PHP errors.

  2. #2
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Is there any space before your opening <?php tag?

  3. #3
    SitePoint Enthusiast HappyPike's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am pretty sure no. It must have something to do with the php tag. Maybe using PHP to echo the declaration will always give the white space error?

  4. #4
    SitePoint Addict loadx's Avatar
    Join Date
    Jul 2004
    Location
    Melbourne, VIC, Australia
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i wouldn't be echoing the xml declaration inside PHP anyhow

    however, try heredoc syntax i rekcon that might work

  5. #5
    SitePoint Enthusiast HappyPike's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh well, still can't get rid of the warning. I will just drop the first line from my page. It's not essential I think.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •