You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by James Hang <jh...@bea.com> on 2007/03/03 02:17:01 UTC

Xpath queries containing blank spaces and a period

We're having problems running an xpath query where a node name in the xpath
contains a blank space followed by a period "." in the name.

For example, the following query fails:

/jcr:root//mypath/My Document.txt//element(*, myType) order by @cx:created
ascending

It throws this exception:

javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 100. 
Encountered: "." (46), after : "": Lexical error at line 1, column 100. 
Encountered: "." (46), after : "": Lexical error at line 1, column 100. 
Encountered: "." (46), after : ""

We think it's failing because of the blank space followed by the period "."
in the name "My Document.txt".

We tried uri encoding the name, which replaces the space with %20, but that
gives us this error:

javax.jcr.query.InvalidQueryException: Lexical error at line 1, column 110. 
Encountered: "2" (50), after : "%": Lexical error at line 1, column 110. 
Encountered: "2" (50), after : "%": Lexical error at line 1, column 110. 
Encountered: "2" (50), after : "%"

Is there a consistent way of escaping the node name to get around this
problem?

-- James 
-- 
View this message in context: http://www.nabble.com/Xpath-queries-containing-blank-spaces-and-a-period-tf3336967.html#a9280684
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.