You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by BenoitX <be...@yahoo.com> on 2009/08/19 17:48:23 UTC

XDoc and "&" in a URL...

Hi *,

I need to generate an XDOC with a header that contains a link to a
javascript. So far, no problem.

However, the URL where the code is contains a "&"

<script type="text/javascript" charset="utf-8"
src="http://bit.ly/javascript-api.js?version=latest&login=statsvn&apiKey=R_2c362b417d0517c27876cbaca1bb68cc"></script>

This causes the xdoc plugin to fail (not valid XML).

If I replace this "&" by "&amp;" the xdoc does not complain BUT I end up
with &amp; in the html generated and this means that the link does not work
as planned...

I've tried to read as much a possible on xdoc format... and I tried:
1/ <escapeXml> : it fails
2/ <!CDATA[[ ... : the script is NOT included in the HTML at the end...

How could I do this?

Thanks a lot

Benoit
-- 
View this message in context: http://n2.nabble.com/XDoc-and-%22-%22-in-a-URL...-tp3473248p3473248.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: XDoc and "&" in a URL...

Posted by Martin Gainty <mg...@hotmail.com>.
i usually supply hex code
&#X26

or theFour character entity references
&amp; 

or straight decimal
&#38;

http://www.w3.org/TR/REC-html40/charset.html
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 19 Aug 2009 12:10:32 -0500
> Subject: Re: XDoc and "&" in a URL...
> From: waynefay@gmail.com
> To: users@maven.apache.org
> 
> > Any suggestion so that the html geneated by xdoc would match the second
> > form? or another type of encoding/escaping?
> 
> You're dealing with bit.ly... and asking how to deal with problematic
> ampersands in your URL... are you missing something really obvious?
> ;-)
> 
> http://www.google.com/search?hl=en&q=is+this+a+test&aq=f&oq=&aqi=g10
> becomes
> http://bit.ly/e1GLN
> 
> Wayne
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
Get back to school stuff for them and cashback for you.
http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1

Re: XDoc and "&" in a URL...

Posted by BenoitX <be...@yahoo.com>.
Furthermore, it appears that one cannot use bit.ly to shorten the URL for the
bit.ly javascript; it complains that it is already a bit.ly URL (eventhough
it is rather large and has '&')

Benoit


BenoitX wrote:
> 
> Hi Wayne,
> 
> Thanks for your email.  There is more to it than what you think...
> 
> Yes we are using bit.ly but the bit.ly APIs and the javascript way to
> shorten the current page on-the-fly. So that way StatCVS/StatSVN can put a
> Twitter button on any page and the current URl will be automatically
> bit.ly-fied
> 
> This is explained at
> http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten
> 
> And the suggested link by bit.ly for importing the javascript does contain
> '&'
> 
> May be we could try to "shortify" that one and use it in our code but that
> sounds a bit weird... I'll try it...
> 
> I was just wondering why it seems that the javascript did not login
> properly... (i.e. any links creaed do not seem to appear under our
> account...
> 
> Thanks
> 
> Benoit
> 
> 
> 
> 
> 
> 
> Wayne Fay wrote:
>> 
>>> Any suggestion so that the html geneated by xdoc would match the second
>>> form? or another type of encoding/escaping?
>> 
>> You're dealing with bit.ly... and asking how to deal with problematic
>> ampersands in your URL... are you missing something really obvious?
>> ;-)
>> 
>> http://www.google.com/search?hl=en&q=is+this+a+test&aq=f&oq=&aqi=g10
>> becomes
>> http://bit.ly/e1GLN
>> 
>> Wayne
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/XDoc-and-%22-%22-in-a-URL...-tp3473248p3474020.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by BenoitX <be...@yahoo.com>.
Thanks.

I do not have firebug installed but I just noticed that the bit;ly history
does not seem to contain links created by the key (although it is kind of
implied) but shows the links only for the last hour of people who clicked on
them.

It seems that replacing the & with &38; do the trick... but I need to
re-check &amp; and let you know

Thanks for your help

Benoit


Dominic Mitchell wrote:
> 
> On 19 Aug 2009, at 18:22, BenoitX wrote:
>> Thanks for your email.  There is more to it than what you think...
>>
>> Yes we are using bit.ly but the bit.ly APIs and the javascript way to
>> shorten the current page on-the-fly. So that way StatCVS/StatSVN can  
>> put a
>> Twitter button on any page and the current URl will be automatically
>> bit.ly-fied
>>
>> This is explained at
>> http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten
>>
>> And the suggested link by bit.ly for importing the javascript does  
>> contain
>> '&'
>>
>> May be we could try to "shortify" that one and use it in our code  
>> but that
>> sounds a bit weird... I'll try it...
>>
>> I was just wondering why it seems that the javascript did not login
>> properly... (i.e. any links creaed do not seem to appear under our
>> account...
> 
> Just one further thought.  When you generate the URL containing  
> ampersands, do you see any errors in the firebug console?  If you look  
> at the "Net" tab in firebug, does that give you any clue about whether  
> it's downloading OK?
> 
> -Dom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/XDoc-and-in-a-URL-tp3473248p3480173.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by Dominic Mitchell <do...@semantico.com>.
On 19 Aug 2009, at 18:22, BenoitX wrote:
> Thanks for your email.  There is more to it than what you think...
>
> Yes we are using bit.ly but the bit.ly APIs and the javascript way to
> shorten the current page on-the-fly. So that way StatCVS/StatSVN can  
> put a
> Twitter button on any page and the current URl will be automatically
> bit.ly-fied
>
> This is explained at
> http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten
>
> And the suggested link by bit.ly for importing the javascript does  
> contain
> '&'
>
> May be we could try to "shortify" that one and use it in our code  
> but that
> sounds a bit weird... I'll try it...
>
> I was just wondering why it seems that the javascript did not login
> properly... (i.e. any links creaed do not seem to appear under our
> account...

Just one further thought.  When you generate the URL containing  
ampersands, do you see any errors in the firebug console?  If you look  
at the "Net" tab in firebug, does that give you any clue about whether  
it's downloading OK?

-Dom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by BenoitX <be...@yahoo.com>.
Hi Wayne,

Thanks for your email.  There is more to it than what you think...

Yes we are using bit.ly but the bit.ly APIs and the javascript way to
shorten the current page on-the-fly. So that way StatCVS/StatSVN can put a
Twitter button on any page and the current URl will be automatically
bit.ly-fied

This is explained at
http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten

And the suggested link by bit.ly for importing the javascript does contain
'&'

May be we could try to "shortify" that one and use it in our code but that
sounds a bit weird... I'll try it...

I was just wondering why it seems that the javascript did not login
properly... (i.e. any links creaed do not seem to appear under our
account...

Thanks

Benoit






Wayne Fay wrote:
> 
>> Any suggestion so that the html geneated by xdoc would match the second
>> form? or another type of encoding/escaping?
> 
> You're dealing with bit.ly... and asking how to deal with problematic
> ampersands in your URL... are you missing something really obvious?
> ;-)
> 
> http://www.google.com/search?hl=en&q=is+this+a+test&aq=f&oq=&aqi=g10
> becomes
> http://bit.ly/e1GLN
> 
> Wayne
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/XDoc-and-%22-%22-in-a-URL...-tp3473248p3474001.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by Wayne Fay <wa...@gmail.com>.
> Any suggestion so that the html geneated by xdoc would match the second
> form? or another type of encoding/escaping?

You're dealing with bit.ly... and asking how to deal with problematic
ampersands in your URL... are you missing something really obvious?
;-)

http://www.google.com/search?hl=en&q=is+this+a+test&aq=f&oq=&aqi=g10
becomes
http://bit.ly/e1GLN

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by BenoitX <be...@yahoo.com>.
Hi Dominic,

Thanks for the reply.

Indeed it needs to be escaped but FireFox 3.5 does not seem to download the
script correctly.

If I change the &amp; to be & in the generated HTML file, it then works. I
do not think that the issue is with bit.ly but the browser then?

Generated and not working:
<script type="text/javascript" charset="utf-8">
src="http://bit.ly/javascript-api.js?version=latest&amp;login=statsvn&amp;apiKey=R_2c362b417d0517c27876cbaca1bb68cc"></script>

Modified and working:
<script type="text/javascript" charset="utf-8">
src="http://bit.ly/javascript-api.js?version=latest&login=statsvn&apiKey=R_2c362b417d0517c27876cbaca1bb68cc"></script>

Any suggestion so that the html geneated by xdoc would match the second
form? or another type of encoding/escaping?

Thanks

Benoit



Dominic Mitchell wrote:
> 
> On 19 Aug 2009, at 16:48, BenoitX wrote:
>> I need to generate an XDOC with a header that contains a link to a
>> javascript. So far, no problem.
>>
>> However, the URL where the code is contains a "&"
>>
>> <script type="text/javascript" charset="utf-8"
>> src="http://bit.ly/javascript-api.js?version=latest&login=statsvn&apiKey=R_2c362b417d0517c27876cbaca1bb68cc 
>> "></script>
>>
>> This causes the xdoc plugin to fail (not valid XML).
>>
> 
> That's correct behaviour — you have to escape all ampersands in XML in  
> order for it to be well-formed.
> 
>> If I replace this "&" by "&amp;" the xdoc does not complain BUT I  
>> end up
>> with &amp; in the html generated and this means that the link does  
>> not work
>> as planned...
> 
> It certainly should do.  Which browser is interpreting the link  
> incorrectly?
> 
>> I've tried to read as much a possible on xdoc format... and I tried:
>> 1/ <escapeXml> : it fails
>> 2/ <!CDATA[[ ... : the script is NOT included in the HTML at the  
>> end...
>>
>> How could I do this?
> 
> You can't.  You have to escape the ampersand.
> 
> -Dom
> 

-- 
View this message in context: http://n2.nabble.com/XDoc-and-%22-%22-in-a-URL...-tp3473248p3473830.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: XDoc and "&" in a URL...

Posted by Dominic Mitchell <do...@semantico.com>.
On 19 Aug 2009, at 16:48, BenoitX wrote:
> I need to generate an XDOC with a header that contains a link to a
> javascript. So far, no problem.
>
> However, the URL where the code is contains a "&"
>
> <script type="text/javascript" charset="utf-8"
> src="http://bit.ly/javascript-api.js?version=latest&login=statsvn&apiKey=R_2c362b417d0517c27876cbaca1bb68cc 
> "></script>
>
> This causes the xdoc plugin to fail (not valid XML).
>

That's correct behaviour — you have to escape all ampersands in XML in  
order for it to be well-formed.

> If I replace this "&" by "&amp;" the xdoc does not complain BUT I  
> end up
> with &amp; in the html generated and this means that the link does  
> not work
> as planned...

It certainly should do.  Which browser is interpreting the link  
incorrectly?

> I've tried to read as much a possible on xdoc format... and I tried:
> 1/ <escapeXml> : it fails
> 2/ <!CDATA[[ ... : the script is NOT included in the HTML at the  
> end...
>
> How could I do this?

You can't.  You have to escape the ampersand.

-Dom