Hi Joerg,

Your snippet works well for me (with "&")!

So, if I'm right this means that it isn't a bug but a problem in my code!?

=> I have found that it was a matcher problem in my sitemap!
Now it works!


Thank you all for you help
Sylvain



-----Message d'origine-----
De: Joerg Heinicke [mailto:[EMAIL PROTECTED]]
Date: mercredi, 15. janvier 2003 10:47
À: [EMAIL PROTECTED]
Objet: Re: & in url [WAS: file generator error]


Hi Sylvain,

yes, we lost the original posting a bit ;-)

[EMAIL PROTECTED] wrote:
> Joerg,
> 
> I found the same as you if I type the URL in my browser.

Nice to hear.

> But in my case the problem is that the URL will be parsed through an
> XML parser.
> 
> If I type "&" the XML parser returns me this error: An error occurred
>  The org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode
> notifies that org.apache.cocoon.ProcessingException says: The
> reference to entity "c" must end with the ';' delimiter.
> 
> More precisely: org.apache.cocoon.ProcessingException: Failed to load
> sitemap from
> file:/C:/jakarta-tomcat-4.1.12/webapps/cocoon/woc/portal-fw/sitemap.xmap:
> 
>file:/C:/jakarta-tomcat-4.1.12/webapps/cocoon/woc/portal-fw/sitemap.xmap:168:70:org.xml.sax.SAXParseException:
> The reference to entity "c" must end with the ';' delimiter.

That's clear, it must be so. & means "here starts an entity". And in 
contrast to most HTML browsers an XML parser doesn't try to add the 
obviously missing ';'.

> And If I type "&" the XML parser doesn't return an error but the
> link isn't correct anymore because it uses "&" instead of "&".

And here you are wrong. The link *is* correct then. Similar to HTML 
(e.g. <a href=""/>) you *must* escape & to &amp; (HTML browsers only try 
to solve the problem themselves, if they find an & without ;). And as 
you can see below in the quoted message I had it working (&amp; is 
resolved to &). Try to add this little snippet into the sitemap (only 
map:generate + map:serialize), test it, have a look into the core.log 
and tell me, what's wrong with your Cocoon version. Maybe you test a 
newer one, if there was really a bug in the resolving, but I don't 
assume so.

Regards,

Joerg

>>> -----Message d'origine----- De: Joerg Heinicke
>>> [mailto:[EMAIL PROTECTED]]
>>> 
>>> Hello Geoff and Sylvain,
>>> 
>>> I can't confirm a bug using Cocoon 2.1 dev from CVS (2003-01-07).
>>> 
>>> 
>>> Using this sitemap snippet
>>> 
>>> <map:match pattern="test"> <map:generate 
>>> src="http://www.moreover.com/cgi-local/page?o=xml&amp;c=Virus%20wa
>>>  rnings"/> <map:serialize type="xml"/> </map:match>
>>> 
>>> 
>>> DEBUG   (2003-01-13) 16:48.59:984   [core.manager]
>>> (/cocoon/joerg/test) Thread-9/SourceResolverImpl: Resolving 
>>> 'http://www.moreover.com/cgi-local/page?o=xml&c=Virus%20warnings'
>>> with base 'file:/D:/xml/' in context 'file:/D:/Tomcat/bin/'
>>> DEBUG (2003-01-13) 16:48.59:984   [core.manager]
>>>(/cocoon/joerg/test) Thread-9/SourceResolverImpl: Resolved to systemID 
>>> 'http://www.moreover.com/cgi-local/page?o=xml&c=Virus%20warnings'
>>>  DEBUG   (2003-01-13) 16:48.59:984   [core.manager]
>>> (/cocoon/joerg/test) Thread-9/SourceResolverImpl: Making URL from
>>>  http://www.moreover.com/cgi-local/page?o=xml&c=Virus%20warnings


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to