default element namespace and restxq

Wednesday, 27 November 2013 · 2 messages · last reply 29 Nov 2013
S
sechel27 Nov 2013 18:21 #
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 sechel at math.tu-berlin.de http://www.math.tu-berlin.de/~sechel
CG
Christian Grün29 Nov 2013 18:06 #
Hi Stefan, thanks for the bug report. The issue is now fixed in the latest stable snapshot [1]. Best, Christian [1] http://files.basex.org/releases/latest/
Quoted text · sechel · 64 lines
On Wed, Nov 27, 2013 at 6:21 PM, <sechel at math.tu-berlin.de> wrote: > 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 sechel at math.tu-berlin.de > http://www.math.tu-berlin.de/~sechel > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery