we figured out following error by using of CMIS queries with Modeshape:

- Create a folder with a literal as name (e.g.: '1')

- Create sub-folder in this folder (e.g.: 'subfolder')

- Create a document in this subfolder

- Execute following CMiS query to search for the document

SELECT * FROM cmis:document WHERE IN_FOLDER (<OBJECT ID OF THE SUB FOLDER>)

As result following exception is thrown:

The xpath query &quot;/jcr:root/1/subfolder/element(*,nt:file)[(@jcr:mixinTypes = 'mix:simpleVersionable')]&quot; has one or more errors: A literal is not supported in the primary path expression; therefore '1' is not valid

The problem is, that I don't even have a chance to escape something, as the path is generated by Modeshape api (I just provide the object id of the sub folder).