Java interop (java.net.URI) problem

Sunday, 29 June 2014 · 5 messages
MG
Marc van Grootel29 Jun 2014 13:08 #
Hola, So, this is my very first post here. I started my first 'serious' xquery project after doing xslt mostly for a long long time. Soon I hope to put something on github. I needed to parse information from a URL and thought I could use java.net.URI instead of doing the hairy URI string parsing myself. As far as I can see this should work according to the documentation. But it's not:
declare namespace uri = "java.net.URI";

let $uri := uri:new('http://basex.org')
return
  uri:get-host($uri)
It gives me: [FORG0006] Invalid call of Java function: URI.getHost(xs:anyURI). Any idea what I'm doing wrong here? --Marc
CG
Christian Grün29 Jun 2014 14:30 #
Hi Marc,
Quoted text · Marc van Grootel · 1 line
> Any idea what I'm doing wrong here?
It turns out you didn't do wrong anything: The mapping between Java and XQuery URIs was only uni-directional. I have just uploaded a new snapshot which provides a fix for this [1]. Hope this helps, Christian [1] http://files.basex.org/releases/latest/
Quoted text · Marc van Grootel · 21 lines
> So, this is my very first post here. I started my first 'serious' xquery > project after doing xslt mostly for a long long time. Soon I hope to put > something on github. > > I needed to parse information from a URL and thought I could use > java.net.URI instead of doing the hairy URI string parsing myself. > > As far as I can see this should work according to the documentation. But > it's not: > > declare namespace uri = "java.net.URI"; > > let $uri := uri:new('http://basex.org') > return > uri:get-host($uri) > > It gives me: [FORG0006] Invalid call of Java function: > URI.getHost(xs:anyURI). > > > --Marc
MG
Marc van Grootel29 Jun 2014 16:12 #
Hi Christian, Terrific on both counts. That I understood correctly :) and that it got fixed so fast! I will probably post more often as I am now working with BaseX regularly both at work and at home. My home project is a collection of modules for doing REST pipelines/middleware, heavily inspired on Python's WSGI, Ruby Rack or Erlang's webmachine. This will be heavily based on Clojure's Ring and Compojure libraries and for now in pure XQuery. Hope to have something to play with in a week or two. --Marc
Quoted text · Christian Grün · 38 lines
On Sun, Jun 29, 2014 at 2:30 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Marc, > > > Any idea what I'm doing wrong here? > > It turns out you didn't do wrong anything: The mapping between Java > and XQuery URIs was only uni-directional. I have just uploaded a new > snapshot which provides a fix for this [1]. > > Hope this helps, > Christian > > [1] http://files.basex.org/releases/latest/ > > > > So, this is my very first post here. I started my first 'serious' xquery > > project after doing xslt mostly for a long long time. Soon I hope to put > > something on github. > > > > I needed to parse information from a URL and thought I could use > > java.net.URI instead of doing the hairy URI string parsing myself. > > > > As far as I can see this should work according to the documentation. But > > it's not: > > > > declare namespace uri = "java.net.URI"; > > > > let $uri := uri:new('http://basex.org') > > return > > uri:get-host($uri) > > > > It gives me: [FORG0006] Invalid call of Java function: > > URI.getHost(xs:anyURI). > > > > > > --Marc >
-- --Marc
MG
Marc van Grootel29 Jun 2014 16:18 #
I can confirm that it works now. Thanks again. --Marc
Quoted text · Marc van Grootel · 64 lines
On Sun, Jun 29, 2014 at 4:12 PM, Marc van Grootel < marc.van.grootel at gmail.com> wrote: > Hi Christian, > > Terrific on both counts. That I understood correctly :) and that it got > fixed so fast! > > I will probably post more often as I am now working with BaseX regularly > both at work and at home. My home project is a collection of modules for > doing REST pipelines/middleware, heavily inspired on Python's WSGI, Ruby > Rack or Erlang's webmachine. This will be heavily based on Clojure's Ring > and Compojure libraries and for now in pure XQuery. Hope to have something > to play with in a week or two. > > --Marc > > > > > On Sun, Jun 29, 2014 at 2:30 PM, Christian Grün <christian.gruen at gmail.com > > wrote: > >> Hi Marc, >> >> > Any idea what I'm doing wrong here? >> >> It turns out you didn't do wrong anything: The mapping between Java >> and XQuery URIs was only uni-directional. I have just uploaded a new >> snapshot which provides a fix for this [1]. >> >> Hope this helps, >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> > So, this is my very first post here. I started my first 'serious' xquery >> > project after doing xslt mostly for a long long time. Soon I hope to put >> > something on github. >> > >> > I needed to parse information from a URL and thought I could use >> > java.net.URI instead of doing the hairy URI string parsing myself. >> > >> > As far as I can see this should work according to the documentation. But >> > it's not: >> > >> > declare namespace uri = "java.net.URI"; >> > >> > let $uri := uri:new('http://basex.org') >> > return >> > uri:get-host($uri) >> > >> > It gives me: [FORG0006] Invalid call of Java function: >> > URI.getHost(xs:anyURI). >> > >> > >> > --Marc >> > > > > -- > --Marc >
-- --Marc
CG
Christian Grünin reply to Marc van Grootel, 29 Jun 2014, 16:1229 Jun 2014 17:32 #
Quoted text · Marc van Grootel · 6 lines
> I will probably post more often as I am now working with BaseX regularly > both at work and at home. My home project is a collection of modules for > doing REST pipelines/middleware, heavily inspired on Python's WSGI, Ruby > Rack or Erlang's webmachine. This will be heavily based on Clojure's Ring > and Compojure libraries and for now in pure XQuery. Hope to have something > to play with in a week or two.
Thanks, looking forward! Christian

⚡Generated with XQuery