JAXP XPath compile can't resolve extension ns
Added by Anonymous over 17 years ago
Legacy ID: #4307830 Legacy Poster: gloewy (gloewy)
It seems that saxon fails to resolve extension function ns using the jaxp APIs. Other parsers work just fine for the exact same code. The code: XPathFactory xpf = new XPathFactoryImpl(); <-- This is the saxon class xpf.setXPathFunctionResolver(new MyXPathFunctionResolver()); XPath xp = xpf.newXPath(); XPathExpression xpe = xp.compile(xpathExpression); Fails with: net.sf.saxon.trans.StaticError: XPath syntax error at char 13 on line 2 in {...ictionary() = '55'}: Prefix xyz has not been declared at net.sf.saxon.expr.ExpressionParser.grumble(ExpressionParser.java:160) at net.sf.saxon.expr.ExpressionParser.grumble(ExpressionParser.java:136) at net.sf.saxon.expr.ExpressionParser.parseFunctionCall(ExpressionParser.java:1821) ... Based on the debug, the resolver is never called in case of saxon. Does anyone have an idea if this is a bug or am I missing something? Thanks, Guy.
Replies (2)
RE: JAXP XPath compile can't resolve extensio - Added by Anonymous over 17 years ago
Legacy ID: #4307839 Legacy Poster: Michael Kay (mhkay)
If it says Prefix xyz has not been declared then I would tend to believe it: it looks as if you haven't declared the prefix. Michael Kay
RE: JAXP XPath compile can't resolve extension ns - Added by Anonymous over 17 years ago
Legacy ID: #4308051 Legacy Poster: gloewy (gloewy)
Figured it out. I was missing: xp.setNamespaceContext(...) Thanks, Guy.
Please register to reply