Hello Marc,
URLEncoder has no public constructor, URLDecoder has. Using import to
bind to Java, BaseX tries to create a new instance, which is not
possible without a constructor. Use declare, i.e.
declare namespace encoder = "java:java.net.URLEncoder";
to access static methods.
Cheers,
Dirk
--
On 30/07/14 18:17, Marc van Grootel wrote:
> Hi,
>
> What could be the reason that importing java.net.URLDecoder works as
> expected but doing the same with java.net.URLEncoder doesn't.
>
> The following works:
>
> import module namespace decoder = "java.net.URLDecoder";
> decoder:decode('foo/bar%20baz')
>
> => 'foo/bar baz'
>
> This gives a "Could not instantiate module 'java.net.URLEncoder'
>
> import module namespace encoder = "java.net.URLEncoder";
> encoder:encode('foo/bar baz')
>
> --Marc
>
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22