問題、質問

数値から始まる名前のノードを含む XPath クエリーを使用しようとすると、次の例外が発生します。

Caused by: javax.jcr.query.InvalidQueryException: Parse error: data is not a RelationQueryNode at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:504) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:551) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.SimpleNode.childrenAccept(SimpleNode.java:89) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.createPathQueryNode(XPathQueryBuilder.java:734) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.visit(XPathQueryBuilder.java:372) at org.apache.jackrabbit.core.query.xpath.SimpleNode.jjtAccept(SimpleNode.java:80) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.<init>(XPathQueryBuilder.java:297) at org.apache.jackrabbit.core.query.xpath.XPathQueryBuilder.createQuery(XPathQueryBuilder.java:331) at org.apache.jackrabbit.core.query.xpath.QueryBuilder.createQueryTree(QueryBuilder.java:39) at org.apache.jackrabbit.core.query.QueryParser.parse(QueryParser.java:57) at org.apache.jackrabbit.core.query.lucene.QueryImpl.<init>(QueryImpl.java:91) at com.day.crx.query.lucene.CRXExecutableQueryImpl.<init>(CRXExecutableQueryImpl.java:64) at com.day.crx.query.lucene.LuceneHandler.createExecutableQuery(LuceneHandler.java:381) at org.apache.jackrabbit.core.query.QueryImpl.init(QueryImpl.java:127) at org.apache.jackrabbit.core.SearchManager.createQuery(SearchManager.java:305) at org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:94)

解決策、回答

次のメソッドを使用して数値ノード名をエンコードするには、このメソッドを使用します:org.apache.jackrabbit.util.ISO9075.encode(name)
または、XPath の代わりに、JCR SQL を使用します。

適用対象

CRX 1.x

参考文献

本作品は Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License によってライセンス許可を受けています。  Twitter™ および Facebook の投稿には、Creative Commons の規約内容は適用されません。

法律上の注意   |   プライバシーポリシー