Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Line Breaks appearing...

    I have the following code:
    PHP Code:
    <?php
    $mime 
    "text/html";
    if(
    stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
            if(
    preg_match("/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
                    
    $xhtml_q $matches[1];
                    if(
    preg_match("/text\/html;q=q=([01]|0\.\d{1,3}|1\.0)/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
                            
    $html_q $matches[1];
                            if((float)
    $xhtml_q >= (float)$html_q) {
                            
    $mime "application/xhtml+xml";
                            }
                    }
            } else {
                    
    $mime "application/xhtml+xml";
                    }
    }
    header ("Content-type: $mime");
    require 
    'giztimer.inc.php';
    $t1 = new Giz_Timer();
    If (
    $mime == "application/xhtml+xml") {
    echo 
    '<?xml version="1.0" encoding="iso-8859-1"?>';
    }
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    Firefox receives this as:
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
            "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    and throws up a XML parsing error: XML Parsing Error: xml processing instruction not at start of external entity... So, the question is, how do I remove the blank line before the XML declaration...

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Strangely, I can remember seeing this same problem on a blog some time ago. Can't remember the resolution, though.

    Anyway, this is a PHP problem and not a HTML problem, so moving over to the server side guys.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by liorean
    Anyway, this is a PHP problem and not a HTML problem, so moving over to the server side guys.
    It wouldn't be an HTML problem anyway, it would've been a XHTML problem

    Why I posted it there? I couldn't make my mind up of whether it was a XHTML or PHP problem...

  • #4
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm going to guess it's this line:

    require 'giztimer.inc.php';

    Because the very nature of require is to replace itself with content. Since your .inc.php file is probably void of output, require replaces itself with nothing (so a blank line is left).

  • #5
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Thanks...

  • #6
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why the ellipsis points? Was I wrong?

  • #7
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by AaronW
    Why the ellipsis points? Was I wrong?
    Because I'm too lazy to write Thank you so much...


  •  

    Posting Permissions

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