Steven Githens wrote:
Hello,
I started using more formats for my folder names today and realized they
aren't XML Element correct and the XPATH query blew up.
I tried escaping:
//site/2f43f30b-f1cc-4b62-803b-dd37c2be1693/mail/messagefolder001/*
order by @sakaijcr:message-date ascending
to:
//site/48c035bd_x002d_8873_x002d_4674_x002d_80e5_x002d_0c5618c3f754/mail/messagefolder001/*
order by @sakaijcr:message-date ascending
after reading seciton 6.4.3 in JSR170, but I still get:
Lexical error at line 1, column 26. Encountered: "_" (95), after : "":
Lexical error at line 1, column 26. Encountered: "_" (95), after : ""
javax.jcr.query.InvalidQueryException: Lexical error at line 1, column
26. Encountered: "_" (95), after : "": Lexical error at line 1, column
26. Encountered: "_" (95), after : "": Lexical error at line 1, column
26. Encountered: "_" (95), after : ""
at
org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.<init>(XPathQueryBuilder.java:267)
Any ideas on how to correclty escape that? I don't use a lot of XPATH
outside this, so I'm hoping it's something obvious, but a bit of
googling didn't turn up much for me.
As far as I can tell, the only thing in
2f43f30b-f1cc-4b62-803b-dd37c2be1693
that needs to be escaped would be the leading digit:
_x0032_2f43f30b-f1cc-4b62-803b-dd37c2be1693
(check out
<http://people.apache.org/~mreutegg/jcr-query-translator/translator.html>,
really useful for testing).
Also, I'm wondering what the best way to proceed on to JCR 2 for
portable queries is. After going through JSR-283 it looks like XPATH is
deprecated and there is a new version of the SQL querying. While
JSR-170 had a fair number of example queries, JSR-283 seems to not have
any examples at all, so I'm not sure what the difference between the
grammers really is.
Any ideas on ways the best way to write your queries so there will be
minimal maintenence after JCR2 is ready in JackRabbit?
I think for Jackrabbit a safe bet will be that JSR170-compliant XPath
queries are going to continue to work -- XPath is made optional after all.
Best regards, Julian