Bug (?) with dynamic namespace constructor
Dear BaseX people, is this a bug: basex "<foo>{namespace {''}{'bar'}}</foo>"=>[XQDY0102] Duplicate namespace declaration: ''.? This works as expected:basex "<foo>{namespace {'xxx'}{'bar'}}</foo>"=><foo xmlns:xxx="bar"/> With kind regards,Hans-Jürgen
Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]” You’ll need to include a (static) namespace URI as part of the direct element constructor: <foo xmlns='bar'/> Best, Christian [1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements
Thank you, Christian, now I understand! Incidentally, nevertheless I am not sure the following behaviour is correct: basex "<_ xmlns='bar'>{element foo {namespace {''} {'bar'}}}</_>/*"=> [XQDY0102] Duplicate namespace declaration: ''. As the dynamic constructor is located in a static context with a default namespace, the foo should be interpreted as a name in that namespace, thus "if the name of an element in an element constructor is in no namespace" does not apply. Cordial greetings,Hans-Jürgen PS: By contrast, this works:basex "<_ xmlns='bar'>{<foo/>}</_>/*" =><foo xmlns="bar"/> PPS: And this also works:basex "<_ xmlns:f='bar'>{element f:foo {namespace {'f'} {'bar'}}}</_>/*" => <f:foo xmlns:f="bar"/> Am Sonntag, 30. Januar 2022, 17:54:24 MEZ hat Christian Grün <christian.gruen@gmail.com> Folgendes geschrieben: Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]” You’ll need to include a (static) namespace URI as part of the direct element constructor: <foo xmlns='bar'/> Best, Christian [1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements
Fixed [1,2]. I ❤ namespaces. [1] https://github.com/BaseXdb/basex/commit/869b411bbfabac57c98e7d756d48e1b38170... [2] https://files.basex.org/releases/latest/ On Sun, Jan 30, 2022 at 11:48 PM Hans-Juergen Rennau <hrennau@yahoo.de> wrote:
Thank you, Christian, now I understand!
Incidentally, nevertheless I am not sure the following behaviour is correct:
basex "<_ xmlns='bar'>{element foo {namespace {''} {'bar'}}}</_>/*" => [XQDY0102] Duplicate namespace declaration: ''.
As the dynamic constructor is located in a static context with a default namespace, the foo should be interpreted as a name in that namespace, thus "if the name of an element in an element constructor is in no namespace" does not apply.
Cordial greetings, Hans-Jürgen
PS: By contrast, this works: basex "<_ xmlns='bar'>{<foo/>}</_>/*" => <foo xmlns="bar"/>
PPS: And this also works: basex "<_ xmlns:f='bar'>{element f:foo {namespace {'f'} {'bar'}}}</_>/*" => <f:foo xmlns:f="bar"/>
Am Sonntag, 30. Januar 2022, 17:54:24 MEZ hat Christian Grün <christian.gruen@gmail.com> Folgendes geschrieben:
Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]”
You’ll need to include a (static) namespace URI as part of the direct element constructor:
<foo xmlns='bar'/>
Best, Christian
[1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements
Wahnsinn - phantastic, so many thanks! Tested - works! Cheers,Hans-Jürgen Am Montag, 31. Januar 2022, 13:47:56 MEZ hat Christian Grün <christian.gruen@gmail.com> Folgendes geschrieben: Fixed [1,2]. I ❤ namespaces. [1] https://github.com/BaseXdb/basex/commit/869b411bbfabac57c98e7d756d48e1b38170... [2] https://files.basex.org/releases/latest/ On Sun, Jan 30, 2022 at 11:48 PM Hans-Juergen Rennau <hrennau@yahoo.de> wrote:
Thank you, Christian, now I understand!
Incidentally, nevertheless I am not sure the following behaviour is correct:
basex "<_ xmlns='bar'>{element foo {namespace {''} {'bar'}}}</_>/*" => [XQDY0102] Duplicate namespace declaration: ''.
As the dynamic constructor is located in a static context with a default namespace, the foo should be interpreted as a name in that namespace, thus "if the name of an element in an element constructor is in no namespace" does not apply.
Cordial greetings, Hans-Jürgen
PS: By contrast, this works: basex "<_ xmlns='bar'>{<foo/>}</_>/*" => <foo xmlns="bar"/>
PPS: And this also works: basex "<_ xmlns:f='bar'>{element f:foo {namespace {'f'} {'bar'}}}</_>/*" => <f:foo xmlns:f="bar"/>
Am Sonntag, 30. Januar 2022, 17:54:24 MEZ hat Christian Grün <christian.gruen@gmail.com> Folgendes geschrieben:
Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]”
You’ll need to include a (static) namespace URI as part of the direct element constructor:
<foo xmlns='bar'/>
Best, Christian
[1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements
participants (2)
-
Christian Grün -
Hans-Juergen Rennau