Hi, I'm experiencing problems using a default element namespace in a restxq module. Here is a working example taken from the default restxq module. All I addded is the namespace of the response element.
module namespace page = 'http://basex.org/modules/web-page'; declare namespace test = 'http://test-namespace.org'; declare %rest:path("/ajax/hello/{$world}") %rest:GET function page:hello($world as xs:string) as element(test:response) { test:response test:titleHello { $world }!</test:title> test:timeThe current time is: { current-time() }</test:time> </test:response> };
If I now introduce a default element namespace just to simplify notation, I get a NullPointerException
module namespace page = 'http://basex.org/modules/web-page'; declare default element namespace 'http://test-namespace.org'; declare %rest:path("/ajax/hello/{$world}") %rest:GET function page:hello($world as xs:string) as element(response) { <response> <title>Hello { $world }!</title> <time>The current time is: { current-time() }</time> </response> };
java.lang.NullPointerException at org.basex.query.expr.Arr.has(Arr.java:46) at org.basex.query.func.StaticFuncCall.has(StaticFuncCall.java:137) at org.basex.query.QueryContext.mainModule(QueryContext.java:203) at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:66) at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:108) at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:100) at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:31) at org.basex.http.BaseXServlet.service(BaseXServlet.java:58) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
Best regards Stefan