[Zope] Re: minor bug CoreSessions - patch

Frank Tegtmeyer fte@lightwerk.com
05 Nov 2001 20:04:40 +0100


"Chris McDonough" <chrism@zope.com> writes:

> AFAIK, replacing & with &amp; would make the resulting URL impossible
> to use in an anchor tag; and that's the primary use for the encodeUrl
> method.

Reading the xhtml 1.0 DTD again you are right - href is URI (CDATA)
and should not be interpreted.

So it seems that validator.w3.org is broken in this aspect?

Look at this example, CDATA is set, but the ampersand is interpreted
as start of an entity:


   1: <!DOCTYPE html 
   2:      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   3:      "DTD/xhtml1-strict.dtd">
   4: <html>
   5: <head>
   6: <title>Test</title>
   7: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
   8: </head>
   9: <body>
  10: <p>
  11: <a href="http://test.com/?a=b&b=c">Link 1</a>
  12: <a href="http://test.com/?a=b&amp;b=c">Link 2</a>
  13: </p>
  14: </body>
  15: </html>
    

Parse Tree

  Axmlns CDATA http://www.w3.org/1999/xhtml
<html>
  <head>
    <title>
       Test
    </title>
      Ahttp-equiv CDATA Content-Type
      Acontent CDATA text/html; charset=iso-8859-1
    <meta>
    </meta>
  </head>
  <body>
    <p>
        Ahref CDATA http://test.com/?a=b=c
        Ashape TOKEN rect
      <a>
         Link 1
      </a>
        Ahref CDATA http://test.com/?a=b&b=c
        Ashape TOKEN rect
      <a>
         Link 2
      </a>
    </p>
  </body>
</html>


Regards, Frank
-- 
CTO Lightwerk GmbH  Email: fte@Lightwerk.com
Phone: +49 2434 800781  Fax: +49 2434 800794
An der Kull 11  *  41844 Wegberg  *  Germany