in reply to Parsing un-encoded ampersand in XHTML

Your snippet is the wrong part, sorry we need another part to suggest something.
Boris
  • Comment on Re: Parsing un-encoded ampersand in XHTML

Replies are listed 'Best First'.
Re^2: Parsing un-encoded ampersand in XHTML
by Anonymous Monk on Oct 08, 2004 at 10:56 UTC
    Sorry as I said new... like today ;) here is the whole thing still working on the validation of tags etc but the code is untouched other than the encoded ampersands..

    astroboy! You may have pointed me to the right place but it all went over my head sorry hope the rest of the code helps. For all I know the code may be way heavier than it needs to be, but it works fine just wont validate as XHTML 1.0 strict. Again thanks for your time! Nathan.

    Janitored by Arunbear - added readmore tags

      Whow, your script should learn about
      use strict; use warnings;
      and lexical vars. you should use code and readmore tags, when posting to PM. Back to the quiestion, in your code replace the lines
      $search_q = $ENV{'QUERY_STRING'}; $search_q =~ s/\&pg=\d+//;
      with
      $search_q = $ENV{'QUERY_STRING'}; $search_q =~ s/\&pg=\d+//; $search_q =~ s/&(?!amp;)/&/g;
      But it is just a guess.
      Boris

        Emphatically SECOND Boris' advise, but also note, running perltidyed vers provided by Arunbear, with warnings ONLY (strict turned off to omit the complaints "...requires explicit package name..."), produces this:

        C:\_wo\pl_test>perl -c amp.pl Name "main::index_loc" used only once: possible typo at amp.pl line 64 +. Name "main::link_target" used only once: possible typo at amp.pl line +171. Name "main::wd" used only once: possible typo at amp.pl line 74. Name "main::docroot_web" used only once: possible typo at amp.pl line +156. Name "main::high_results" used only once: possible typo at amp.pl line + 152. Name "main::page_script" used only once: possible typo at amp.pl line +153. Name "main::grains" used only once: possible typo at amp.pl line 63. amp.pl syntax OK

        Also new, so this may be beside the point, but at a minimum, means you have done (been there, done that) a lot of work that doesn't have a payoff

      For the benefit of anyone reading this thread, here is a perltidy'd version of the script:


        Wow that makes more sense now, I thought it looked messy but was not sure as i only know html css etc, this sort of code baffles me most of the time so i try to avoid it.
        The code you are looking at was downloaded and was released in 2002 if that makes a difference to some of the variables etc.
        I have to say thankyou again for the help as I am an extreme novice, I'll try working with your suggestions and see how it go's.
        cheers Nathan.