XPath query: /a/b/as throws an error: { - results: [ ], - total: 0, - success: false, - time: 0, - errorMessage: "Encountered "as" at line 1, column 16. Was expecting one of: <IntegerLiteral> ... <DecimalLiteral> ... <DoubleLiteral> ... <StringLiteral> ... "<?" ... "<?" ... <AxisChild> ... <AxisDescendant> ... <AxisParent> ... <AxisAttribute> ... <AxisSelf> ... <AxisDescendantOrSelf> ... <AxisAncestor> ... <AxisFollowingSibling> ... <AxisPrecedingSibling> ... <AxisFollowing> ... <AxisPreceding> ... <AxisAncestorOrSelf> ... "$" ... <ElementType> ... <AttributeType> ... <SchemaElementType> ... <SchemaAttributeType> ... <OrderedOpen> ... <UnorderedOpen> ... <ElementQNameLbrace> ... <AttributeQNameLbrace> ... <PINCNameLbrace> ... <PILbrace> ... <CommentLbrace> ... <ElementLbrace> ... <AttributeLbrace> ... <TextLbrace> ... "*" ... <NCNameColonStar> ... <StarColonNCName> ... "(" ... "@" ... <DocumentLpar> ... <DocumentLparForKindTest> ... <DocumentLbrace> ... <NodeLpar> ... <CommentLpar> ... <TextLpar> ... <ProcessingInstructionLpar> ... <ElementTypeForKindTest> ... <ElementTypeForDocumentTest> ... <AttributeTypeForKindTest> ... <SchemaElementTypeForKindTest> ... <SchemaElementTypeForDocumentTest> ... <SchemaAttributeTypeForKindTest> ... <ProcessingInstructionLparForKindTest> ... <TextLparForKindTest> ... <CommentLparForKindTest> ... <NodeLparForKindTest> ... "." ... ".." ... <QNameLpar> ... "<" ... "<" ... "<!--" ... "<!--" ... <QName> ... for statement: for $v in /a/b/as return $v"
} That's jackrabbit 2.6.2 in Adobe CQ 5.6.1 If I understood correctly a XPath parser treats "as" as a reserved word. In jackrabbit code I found this: statement = "for $v in " + statement + " return $v"; // get parser XPath parser; synchronized (parsers) { parser = (XPath) parsers.get(resolver); if (parser == null) { parser = new XPath(new StringReader(statement)); parsers.put(resolver, parser); } } http://grepcode.com/file/repo1.maven.org/maven2/org.apache.jackrabbit/jackrabbit-spi-commons/2.6.2/org/apache/jackrabbit/spi/commons/query/xpath/XPathQueryBuilder.java#285 In linux I've tried to execute the same XPath code using xmllint and it works: $ xmllint --xpath '/a/b/as' test.html <as> as content </as> Any ideas what's wrong with jackrabbit when "as" is part of a path? Adobe guy has confirmed the problem but hasn't provided any solutions. Except using SQL-2 if a path contains "/as" Thanks