XPath queries must be encoded in ISO 9075. There is a helper class in jackrabbit-jcr-commons for that: org.apache.jackrabbit.util.ISO9075 [1]
Regards, Alex [1] http://svn.eu.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ISO9075.java?revision=631235&view=markup On Mon, Nov 10, 2008 at 3:25 PM, Sebastian Lindstaedt <[EMAIL PROTECTED]> wrote: > Hi, > > I'm created a naming scheme for my nodes that uses md5-file hashes of its > attached file (jcr:data) for the node name > Creating of the nodes, goes like this: > ---8<--------- > > Node compoundNode = n.addNode(removeFileExtension(hashValue), > "nt:unstructured"); > > compoundNode.addMixin("mix:versionable"); > > compoundNode.setProperty("fileExtension", extension.toString()); > > compoundNode.setProperty("hashValue", hashValue); > > compoundNode.setProperty("fileName", simpleFileName); > > compoundNode.setProperty("valid", validFile); > > compoundNode.setProperty("jcr:mimeType", mimeType); > > compoundNode.setProperty("jcr:encoding", encoding); > > File file = new File(filePath); > > compoundNode.setProperty("jcr:data",new FileInputStream(file)); > > Calendar lastModified = Calendar.getInstance(); > > lastModified.setTimeInMillis(file.lastModified()); > > compoundNode.setProperty("jcr:lastModified",lastModified); > > session.save(); > > compoundNode.checkin(); > > ---8<--------- > > Given that creation scheme there are nodes with names that start with an > number (e.g. 9428beec5dd65d1b54985661ca3eefca) > > and there are nodes with names, that start with a character (e.g > a980d10665f268b0ec6c13ebea43034f ). Using the same QueryString (except > the different node names), it seems that those starting with a number are not > found and I get an Exception like this: > > A 'javax.jcr.query.InvalidQueryException' has occured. Reason: Encountered > "return" at line 1, column 71 > > The used XQuery String looks like this: > > InfrastructureCategories/R/9428beec5dd65d1b54985661ca3eefca <-- not working > > InfrastructureCategories/R/a980d10665f268b0ec6c13ebea43034f <-- working > > Is something wrong wih my XQuery? Are Nodenames constrained to start with a > letter? > > > > Thanks and Greetings, > > Sebastian > > -- Alexander Klimetschek [EMAIL PROTECTED]
