xhtml strict is being very stict why?

Discussion in 'HTML' started by Christopher R, Oct 1, 2003.

  1. Just beginning php.Why is xhtml validator saying, "end of line reached
    before closing quote. Quoted strings can not span lines.?"


    <!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" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title>Form Feedback</title>
    </head>
    <body>
    <?php
    # Script 2.2 - handle_form.php Tip Extension! Not in the book!
    // $login substituted for $name
    // relates to form.html
    // breaks between the lines causes a parse error


    echo "$login<p> Your email address is $email</p>";

    echo "<p>$password</p>";
    // end of line reached before closing quote. Quoted strings can not span
    lines.
    ?>
    </body>
    </html>
     
    Christopher R, Oct 1, 2003
    #1
    1. Advertising

  2. Christopher R

    DU Guest

    Christopher R wrote:

    > Just beginning php.Why is xhtml validator saying, "end of line reached
    > before closing quote. Quoted strings can not span lines.?"
    >
    >
    > <!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" lang="en">
    > <head>
    > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    > <title>Form Feedback</title>
    > </head>
    > <body>
    > <?php
    > # Script 2.2 - handle_form.php Tip Extension! Not in the book!
    > // $login substituted for $name
    > // relates to form.html
    > // breaks between the lines causes a parse error
    >
    >
    > echo "$login<p> Your email address is $email</p>";


    I'm pretty sure you need to escape the forward slashes like this:

    echo "$login<p> Your email address is $email<\/p>";

    >
    > echo "<p>$password</p>";


    here too:
    echo "<p>$password<\/p>";

    otherwise we would need an url to further verify your file.

    > // end of line reached before closing quote. Quoted strings can not span
    > lines.
    > ?>
    > </body>
    > </html>
    >
    >


    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
    http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
     
    DU, Oct 1, 2003
    #2
    1. Advertising

  3. Christopher R

    Adrienne Guest

    Gazing into my crystal ball I observed "Christopher R"
    <> writing in
    news:bld9sh$ariob$-berlin.de:

    > Just beginning php.Why is xhtml validator saying, "end of line reached
    > before closing quote. Quoted strings can not span lines.?"
    >
    >
    ><!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" lang="en"> <head>
    > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
    > /> <title>Form Feedback</title> </head> <body> <?php
    > # Script 2.2 - handle_form.php Tip Extension! Not in the book!
    > // $login substituted for $name
    > // relates to form.html
    > // breaks between the lines causes a parse error
    >
    >
    > echo "$login<p> Your email address is $email</p>";
    >
    > echo "<p>$password</p>";
    > // end of line reached before closing quote. Quoted strings can not
    > span lines.
    > ?>
    ></body>
    ></html>
    >
    >
    >


    Are you validating the code, or the XHTML that was generated by the code?
    You need to validate the XHTML the PHP is generating, not the PHP code (of
    course the PHP needs to be valid to generate the XHTML correctly).

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
     
    Adrienne, Oct 1, 2003
    #3
  4. Re: xhtml strict is being very strict why?

    "Adrienne" <> wrote in message
    news:Xns9406BCE88E681arbpenyahoocom@207.115.63.158...
    > Gazing into my crystal ball I observed "Christopher R"
    > <> writing in
    > news:bld9sh$ariob$-berlin.de:
    >
    > > Just beginning php.Why is xhtml validator saying, "end of line reached
    > > before closing quote. Quoted strings can not span lines.?"
    > >
    > >
    > ><!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" lang="en"> <head>
    > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
    > > /> <title>Form Feedback</title> </head> <body> <?php
    > > # Script 2.2 - handle_form.php Tip Extension! Not in the book!
    > > // $login substituted for $name
    > > // relates to form.html
    > > // breaks between the lines causes a parse error
    > >
    > >
    > > echo "$login<p> Your email address is $email</p>";
    > >
    > > echo "<p>$password</p>";
    > > // end of line reached before closing quote. Quoted strings can not
    > > span lines.
    > > ?>
    > ></body>
    > ></html>
    > >
    > >
    > >

    >
    > Are you validating the code, or the XHTML that was generated by the code?
    > You need to validate the XHTML the PHP is generating, not the PHP code (of
    > course the PHP needs to be valid to generate the XHTML correctly).
    >
    > --
    > Adrienne Boswell
    > Please respond to the group so others can share
    > http://www.arbpen.com

    I'm validating the posted code here using homesite's validator. The message
    returned is, end of line reached before closing quote. Quoted strings can
    not
    span lines. End of message. I need to put a semi-colon after the quote. I
    even tried to put the quote at the end of the line but no luck. If I
    understand your question correctly, I am validating the code. It works fine
    but just gives me a validation error. Why?
    Thanks in advance.
     
    Christopher R, Oct 1, 2003
    #4
  5. Re: xhtml strict is being very strict why?

    Christopher R pounced upon this pigeonhole and pronounced:
    >
    > I'm validating the posted code here using homesite's validator.


    We probably all assumed you meant the W3C web page validator.

    http://validator.w3.org/

    How do your pages fare at this site?

    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Oct 1, 2003
    #5
  6. Re: xhtml strict is being very strict why?

    <!--This kind of quote works inside the php tag -->

    //but this sort gives me an error.

    It is working now.
     
    Christopher R, Oct 1, 2003
    #6
  7. Christopher R

    SteW Guest

    Christopher R wrote:

    > Just beginning php.Why is xhtml validator saying, "end of line reached
    > before closing quote. Quoted strings can not span lines.?"
    >


    <html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="en" lang="en">
    ^
    You have 7 quote marks - they should come in pairs.

    Ste W
     
    SteW, Oct 1, 2003
    #7
  8. Re: xhtml strict is being very strict why?

    "Christopher R" <> wrote in message news:<bldf28$b3pfr$-berlin.de>...
    > "Adrienne" <> wrote in message
    > news:Xns9406BCE88E681arbpenyahoocom@207.115.63.158...
    > > Gazing into my crystal ball I observed "Christopher R"
    > > <> writing in
    > > news:bld9sh$ariob$-berlin.de:
    > >
    > > > Just beginning php.Why is xhtml validator saying, "end of line reached
    > > > before closing quote. Quoted strings can not span lines.?"
    > > >
    > > >
    > > ><!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" lang="en"> <head>
    > > > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
    > > > /> <title>Form Feedback</title> </head> <body> <?php
    > > > # Script 2.2 - handle_form.php Tip Extension! Not in the book!
    > > > // $login substituted for $name
    > > > // relates to form.html
    > > > // breaks between the lines causes a parse error
    > > >
    > > >
    > > > echo "$login<p> Your email address is $email</p>";
    > > >
    > > > echo "<p>$password</p>";
    > > > // end of line reached before closing quote. Quoted strings can not
    > > > span lines.
    > > > ?>
    > > ></body>
    > > ></html>
    > > >
    > > >
    > > >

    > >
    > > Are you validating the code, or the XHTML that was generated by the code?
    > > You need to validate the XHTML the PHP is generating, not the PHP code (of
    > > course the PHP needs to be valid to generate the XHTML correctly).
    > >
    > > --
    > > Adrienne Boswell
    > > Please respond to the group so others can share
    > > http://www.arbpen.com

    > I'm validating the posted code here using homesite's validator. The message
    > returned is, end of line reached before closing quote. Quoted strings can
    > not
    > span lines. End of message. I need to put a semi-colon after the quote. I
    > even tried to put the quote at the end of the line but no luck. If I
    > understand your question correctly, I am validating the code. It works fine
    > but just gives me a validation error. Why?
    > Thanks in advance.


    So you're trying to validate unparsed PHP code using an HTML
    validator. Did you really expect that to work? How about trying to
    translate Italian to English using Babelfish's French to English
    translation engine?

    --
    Hywel
     
    Hywel Jenkins, Oct 1, 2003
    #8
  9. Christopher R

    SteW Guest

    Re: xhtml strict is being very strict why?

    Hywel Jenkins wrote:

    > So you're trying to validate unparsed PHP code using an HTML
    > validator. Did you really expect that to work? How about trying to
    > translate Italian to English using Babelfish's French to English
    > translation engine?
    >


    It can work, though it takes more effort to get readable code and there
    are difficulties if you want an <?xml> line with sessions - both want to
    be first. But you know the script will always produce valid html.

    Paste this into a new file, save locally as test.php then use file
    upload (i.e unparsed php) at http://validator.w3.org/ :

    <!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">
    <head>
    <title>php test</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    </head>
    <body>
    <h1>Can a php page validate?</h1>
    <?php $validates = true; ?>
    <p>
    <?php if($validates){
    $answer = "Yes it can.";
    }else{
    $answer = "No it can't.";
    }
    echo $answer;
    ?>
    </p>
    </body>
    </html>
     
    SteW, Oct 1, 2003
    #9
  10. Re: xhtml strict is being very strict why?

    "Christopher R" <> wrote in message news:<bldf28$b3pfr$-berlin.de>...
    > It works fine but just gives me a validation error. Why?


    The browser sees the XHTML result of the code, but you're giving the
    validator the PHP code itself.
     
    Leif K-Brooks, Oct 1, 2003
    #10
  11. Christopher R

    SteW Guest

    "SteW" wrote
    > <html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="en" lang="en">
    > ^
    > You have 7 quote marks - they should come in pairs.
    >


    Just viewed this in outlook express and the caret isn't where I placed it.
    It should point under second the two quote marks between /xhtml and
    xml:lang.

    Ste W
     
    SteW, Oct 1, 2003
    #11
  12. Re: xhtml strict is being very strict why?

    Homesite's Validate isn't designed to validate PHP. I know that I used
    to use Homesite and its validator all the time when I used HTML 4, but
    now that I use XHTML inside of PHP, I don't even bother with the
    validator anymore. If you want a good validator, check out
    validator.w3.org. It will check for valid HTML after the PHP engine
    has parsed the code, not before like Homesite attempts to do.
     
    StealthMonkey, Oct 1, 2003
    #12
  13. Re: xhtml strict is being very strict why?

    SteW <> wrote:

    > But you know the script will always produce valid html.


    Huh? Why validate then? Or so you mean that a validator report of PHP
    code would somehow mean that the HTML documents are valid?

    > Paste this into a new file, save locally as test.php then use file
    > upload (i.e unparsed php) at http://validator.w3.org/ :


    That wouldn't mean much, since a validator treats <?php ...?> as
    processing instructions and effectively ignores them.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Oct 1, 2003
    #13
  14. Christopher R

    SteW Guest

    Re: xhtml strict is being very strict why?

    Jukka K. Korpela wrote:

    > Huh? Why validate then? Or so you mean that a validator report of PHP
    > code would somehow mean that the HTML documents are valid?
    >
    >>Paste this into a new file, save locally as test.php then use file
    >>upload (i.e unparsed php) at http://validator.w3.org/ :

    >
    > That wouldn't mean much, since a validator treats <?php ...?> as
    > processing instructions and effectively ignores them.
    >


    The php script engine will test the syntax of the php. Let's use the
    validator to detect syntax errors in html markup.

    This style uses php to generate the content only:
    <p>
    <?php
    if ($a){
    echo " this ";
    }else{
    echo " that ";
    }
    ?>
    </p>

    The validator need only be used once as the html does not change, no
    matter which condition is met.

    This style uses php to generate both the content and the markup:
    <?php
    if ($a){
    echo "<p> this </p>";
    }else{
    echo "<p that </p>"
    }
    ?>

    The validator can now only be used to check the _output_ of the php
    script. In this example there are two possible pages to check. One of
    the pages will have incorrect syntax.
    With n such constructs the output of 2^n possibilities must be checked.

    Ste W
     
    SteW, Oct 1, 2003
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    499
    Raymond Hettinger
    Jul 27, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,073
    Smokey Grindel
    Dec 2, 2006
  3. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,677
    Merrill & Michele
    Oct 19, 2004
  4. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    445
    jacob navia
    Oct 17, 2004
  5. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    526
    Dave Thompson
    Feb 14, 2005
Loading...

Share This Page