How to do & in a <media href="...?

Shaun McCance <shaunm at gnome.org>
Mon Oct 22 16:13:36 EDT 2012

On Mon, 2012-10-22 at 21:05 +0200, Voidcode wrote:
> Hello.
> 
> I am trying to insert an paypal-donate link in my
> help-dialog(projectmallard)
> The link look like this:
> <p>
>       <media 
> 
> href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=terkelsorensen%40gmail%2ecom&lc=US&no_note=0&currency_code=DKK&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest" 
>             type="image" mime="image/png" 
>             src="figures/paypal.png"/>
> </p>
> 
> The problem is '&' in the href-tag..
> If I use '&' then the help-dialog response with:
> Page Not Found
> The page ‘donate’ was not found in the document
> ‘ghelp:/path/to/my/app/help/C’.
> 
> 
> 
> So is there an way fix this? 

The ampersand is a special character in XML, used to mark up entity
references like &lt; or &#x2234;. If you want to use an ampersand
anywhere outside a comment or a CDATA section, you have to escape
it as &amp;. This is true for any XML vocabulary, not just Mallard.

So if you have a URL that looks like this:

  http://example.com/foo?fe=fi&fo=fum

Then you have to write it like this:

  http://example.com/foo?fe=fi&amp;fo=fum

--
Shaun