Problems with function transormation function put and namespaces
Monday, 8 March 2010 · 2 messages
JK
Jiří Kadlec8 Mar 2010 10:07 #
Hi Guys,
I'm have problems with BASE-X and namespaces when I'm using put function for e.g
declare namespace bk := "http://acision.com.uri";
put( copy $nn := doc('D:/tstxml.xml') modify insert node <x/> into $nn/site/region/bk:africa return $nn, 'D:/tstxml.xml')start of the tstxml.xml look like this
<site xmlns:bk="http://acision.com.uri">
<regions>
<bk:africa>I found out that when I use this the same query without specifying namespace it inserts element <x/> into bk:africa but it changes the document and it looks like:
<site >
<regions>
<bk:africa xmlns:bk="http://acision.com.uri">
....
...
</x>
</bk:africa>Is this a bug or am I doing something wrong? I need to use namespace prefix in put function is it possible or it's not supported by BASE-X at all?
Thank for help
Jiri
CG
Christian Grün8 Mar 2010 19:38 #
Dear Jiří,
I tried to trace your problem, but I'm sorry I didn't succeed. If you omit the namespace declaration in your query, you'll most likely get an unknown prefix exception (XPST0081), and no document should be changed.
Please don't hesitate to supply us with more concise XML snippets and XQuery expressions, which allow reproducing the core problem.
Best,
Christian
Quoted text · Jiří Kadlec · 30 lines
On Mon, Mar 8, 2010 at 10:07 AM, Jiří Kadlec <jir.kadlec at post.cz> wrote: > Hi Guys, > > I'm have problems with BASE-X and namespaces when I'm using put function for e.g > > declare namespace bk := "http://acision.com.uri"; > put( copy $nn := doc('D:/tstxml.xml') modify insert node <x/> into $nn/site/region/bk:africa return $nn, 'D:/tstxml.xml') > > start of the tstxml.xml look like this > > <site xmlns:bk="http://acision.com.uri"> > <regions> > <bk:africa> > > I found out that when I use this the same query without specifying namespace it inserts element <x/> into bk:africa but it changes the document and it looks like: > > > <site > > <regions> > <bk:africa xmlns:bk="http://acision.com.uri"> > .... > ... > </x> > </bk:africa> > > Is this a bug or am I doing something wrong? I need to use namespace prefix in put function is it possible or it's not supported by BASE-X at all? > > Thank for help > > Jiri
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery