False parsing error inside href="http://..." !

View: New views
5 Messages — Rating Filter:   Alert me  

False parsing error inside href="http://..." !

by Dominique Meeùs-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

*** Errors/warnings in [MyFile].html
  line 1969, char 98: not well-formed (invalid token)
But the line is
  <em class="ouvrage"><a
href="http://studies.d-meeus.be/wikindx3/index.php?action=resourceView&id=401">Dreams

which is perfectly legitimate (char. 98 is the d of id=). I ask the file
index.php to view the resource whose id is 401. I cannot but write
id=401. Amaya should not bother with what I write between the " ".








Re: False parsing error inside href="http://..." !

by Helder Magalhães :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dominique,


>  line 1969, char 98: not well-formed (invalid token)
> But the line is
>  <em class="ouvrage"><a
> href="http://studies.d-meeus.be/wikindx3/index.php?action=resourceView&id=401">Dreams
> which is perfectly legitimate (char. 98 is the d of id=).

The problem here isn't the "d" of "id" but it's the fact that you
haven't escaped the "&" character in the URL, reason why Amaya (and
probably other browsers/HTML parsers also) is complaining: it's trying
to parse "id" as an HTML/XML entity [1]. Replacing "&" by "&" will
probably "fix" it (note that I haven't tried to reproduce this
behavior). ;-)


Hope this helps,
 Helder


[1] http://www.w3schools.com/HTML/html_entities.asp


Re: False parsing error inside href="http://..." !

by Dominique Meeùs-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Helder Magalhães a écrit ce qui suit, le 31/08/09 12:06 :
Hi Dominique,
 line 1969, char 98: not well-formed (invalid token)
But the line is
 <em class="ouvrage"><a
href="http://studies.d-meeus.be/wikindx3/index.php?action=resourceView&id=401">Dreams
which is perfectly legitimate (char. 98 is the d of id=).
    
The problem here isn't the "d" of "id" but it's the fact that you
haven't escaped the "&" character in the URL, reason why Amaya (and
probably other browsers/HTML parsers also) is complaining: it's trying
to parse "id" as an HTML/XML entity [1]. Replacing "&" by "&amp;" will
probably "fix" it (note that I haven't tried to reproduce this
behavior). ;-)

Yes, Amaya was emphasising the d but eventually I understood it was the &

Is it normal to "parse" as html or xml a value inside " " and/or to "correct" it?

Html Tidy does also correct such a & in a URL. I remember that some servers do not understand http requests with &amp; instead of &. I had to re-correct all my &amp; back to & after using Tidy (I knew there were no other & than in URLs). If the correct syntax is "http://domain.net/index.php?action=this&lang=fr&something=that" why should Amaya or Html Tidy make this impossible?

--
Amicalement, Dominique.

Re: False parsing error inside href="http://..." !

by Urs Holzer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dominique Meeùs wrote:
> Is it normal to "parse" as html or xml a value inside " " and/or to
> "correct" it?

Yes, entities inside an attribute value must be parsed. Otherwise it
would not be possible to have a " or a < in an attribute value.

> Html Tidy does also correct such a & in a URL. I remember that some
> servers do not understand http requests with & instead of &. I
> had to re-correct all my & back to & after using Tidy (I knew
> there were no other & than in URLs). If the correct syntax is
> "http://domain.net/index.php?action=this&lang=fr&something=that" why
> should Amaya or Html Tidy make this impossible?

As far as I know, using & directly instead of & has always been
wrong in HTML. I do not know why people started using & directly. The
& never gets sent to a server, since the browser replaces it by &
when it reads the attribute value. It may be that there are some broken
user agents which do not replace the &. In this situation you can
try the following:
http://domain.net/index.php?action=this;lang=fr;something=that
Perhaps PHP can handle this syntax, which just uses a semicolon instead
of &.

Greetings
Urs


Re: False parsing error inside href="http://..." !

by Vincent Quint-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 31/08/09 11:24, Dominique Meeùs wrote:
> *** Errors/warnings in [MyFile].html
>  line 1969, char 98: not well-formed (invalid token)
> But the line is
>  <em class="ouvrage"><a
> href="http://studies.d-meeus.be/wikindx3/index.php?action=resourceView&id=401">Dreams
>
> which is perfectly legitimate (char. 98 is the d of id=). I ask the
> file index.php to view the resource whose id is 401. I cannot but
> write id=401. Amaya should not bother with what I write between the " ".
Amaya is right to complain about this un-escaped '&'. In HTML, character
'&' introduces an entity, which must be closed by a ';'. This applies to
attribute values too.
I guess you mean "&id=401" instead of "&id=401".
You can check your documents with the W3C validator :

   http://validator.w3.org/

Vincent.