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:title>Hello { $world }!</test:title>
    <test:time>The 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

--
Stefan Sechelmann
DFG-Forschungszentrum Matheon
Mathematik für Schlüsseltechnologien
Technische Universität Berlin
Sekretariat MA 8-3              Tel. 030/314 29 486
Straße des 17. Juni 136         Fax  030/314 79 282
10623 Berlin               sec...@math.tu-berlin.de
http://www.math.tu-berlin.de/~sechel

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to