base-uri and put statement
Tuesday, 24 May 2011 · 3 messages
S
Sebastian.Wiemer24 May 2011 08:50 #
Hello,
In an
fn:put(TempNode,URI) I would expect base-uri(Node) as a URI parameter to work.
But base-uri(Node) returns on Windows "file:/C:/somepath/somefile.xml", which does not work, because the URI cannot be opened. The URI "/somepath/somefile.xml" works.
And file://C/somepath/somefile.xml does also work.
Is this a bug?
example:let $doc:= doc("bla.xml")
put(
copy $temp := $doc
modify replace
value of node $temp/n
with lower-case($temp/n)
return $temp,base-uri($doc)
)(: this does not work, but should it not? :)
best regards,
Sebastian
LK
Lukas Kircher24 May 2011 10:12 #
Hi Sebastian,
I'm on a Mac here, so I'm not sure if my experiences apply
to your case as well, but I'll try my best (maybe one of my
team mates can varify?).
If I run the query below for a document, I get a
FileNotFound Exception, just like you:
*
fn:put(root(), fn:base-uri(root()))*
The path returned by fn-base-uri is:*
file:/xml/test.xml
*This doesn't exactly look right to me if I refer to [2]. We'll have a look at this and come back to you as soon as we
know more.
As for now, to make your example work, you could either
switch on the 'writeback' command of BaseX [1], or
process the return value of fn:base-uri to make it a
working path expression.
Thanks for reporting, feel free to ask for more -
Regards,
Lukas
[1] http://docs.basex.org/wiki/Options#Database_options
[2] http://en.wikipedia.org/wiki/File_URI_scheme#Windows_2Quoted text · Sebastian.Wiemer · 46 lines
On Tue, May 24, 2011 at 8:50 AM, <Sebastian.Wiemer at bertelsmann.de> wrote: > Hello, > > In an fn:put(TempNode,URI) I would expect base-uri(Node) as a URI > parameter to work. > > But base-uri(Node) returns on Windows “file:/C:/somepath/somefile.xml”, > > which does not work, because the URI cannot be opened. The URI “ > /somepath/somefile.xml” works. > > And ***file://C****/somepath/somefile.xml* does also work. > > Is this a bug? > > example: > > let $doc:= doc(“bla.xml”) > > put( > > copy $temp := $doc > > modify replace > > value of node $temp/n > > with lower-case($temp/n) > > return $temp,base-uri($doc) > > ) > > (: this does not work, but should it not? :) > > best regards, > > *******Sebastian* > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
LK
Lukas Kircher24 May 2011 10:41 #
Hi Sebastian,
thanks again for your report. There's a problem with
the implementation of
fn:put as the current solution
based on Java FileOutputStream can't handle the kind
of URI we discussed earlier [1].
We'll let you know as soon as we fixed this issue.
Regards,
Lukas
[1] http://www.w3.org/TR/xmlschema-2/#anyURIQuoted text · Lukas Kircher · 78 lines
On Tue, May 24, 2011 at 10:19 AM, <Sebastian.Wiemer at bertelsmann.de> wrote: > Hi Lukas, > > Hi Sebastian, > > … > > > As for now, to make your example work, you could either > switch on the 'writeback' command of BaseX [1], or > process the return value of fn:base-uri to make it a > working path expression. > > I actually tried using the ‘writeback’ switch already. But that took > suspiciously long. It turned > out, that all files were touched by the write back feature, not only the > affected files. > > BTW: My solution was to fix the URI: put ($temp, > replace(base-uri($doc),’file:/’,’file://’)) > > Regards, > > Sebastian > > > > [1] http://docs.basex.org/wiki/Options#Database_options > [2] http://en.wikipedia.org/wiki/File_URI_scheme#Windows_2 > > On Tue, May 24, 2011 at 8:50 AM, <Sebastian.Wiemer at bertelsmann.de> wrote: > > Hello, > > In an fn:put(TempNode,URI) I would expect base-uri(Node) as a URI > parameter to work. > > But base-uri(Node) returns on Windows “file:/C:/somepath/somefile.xml”, > > which does not work, because the URI cannot be opened. The URI “/somepath/somefile.xml” > works. > > And *file://C/somepath/somefile.xml* does also work. > > Is this a bug? > > example: > > let $doc:= doc(“bla.xml”) > > put( > > copy $temp := $doc > > modify replace > > value of node $temp/n > > with lower-case($temp/n) > > return $temp,base-uri($doc) > > ) > > (: this does not work, but should it not? :) > > best regards, > > *Sebastian* > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
Written for BaseX 6.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery