Apostrophe in xwql queries

I have a problem with apostrophe in xwql queries in velocity.
This query works just fine

#set($ls1=$services.query.xwql(“from doc.object(‘Gestion de risques .Plan de gestion des risques.Risques et enjeux.Code.Risques et enjeuxClass’) as risques order by risques.name”).execute())

This one doesn’t

#set($ls1=$services.query.xwql(‘from doc.object(“Gestion de risques .Plan de gestion des risques.Mesures d’atténuation.Code.Mesures d’atténuationClass”) as mesures order by mesures.name’).execute())

Any tips?

Thanks

Hi @MichaelA,

In the first case, double quotes wrap the entire query string and inside them you can use as many single quotes you want without breaking the syntax.
In the second case single quotes are wrongly paired: (‘from with d’atténuation and d’atténuationClass with name’) so the syntax is broken by them.

In fact, pasting this in a text editor, I can see that at the beginning of the query string is used a single quote, while the enclosing one is an apostrophe.

Hope it helps,
Alex

Thanks, but I tried every permutations of quotes. Nothing worked.
I know that in JPQL double single quotes escapes single quotes, but this also didn’t work.

See https://stackoverflow.com/questions/19579748/escaping-quotes-in-velocity-template .