Search code examples
xmlxquerymarklogicxbrl

XDMP-BADNCNAME: :link error in XQuery


Error snippet i get when using the Query console of MarkLogic

[1.0-ml] XDMP-BADNCNAME: :link

Stack Trace

At line 1 column 18: In xdmp:eval("declare namespace xmlns:link="http://www.xbrl.org/2003/link...", (), 11967107844575880929...)

  1. declare namespace xmlns:link="http://www.xbrl.org/2003/linkbase";
  2. declare namespace xmlns:bd-alg="http://www.nltaxonomie.nl/nt11/bd/20161207/dictionary/bd-algemeen";
  3. declare namespace xmlns:bd-bedr="http://www.nltaxonomie.nl/nt11/bd/20161207/dictionary/bd-bedrijven";

Anyone have any idea what is happening?


Solution

  • Namespace declarations must bind a namespace to a prefix that must be the NCName, without the xmlns: part, like so:

    declare namespace link="http://www.xbrl.org/2003/linkbase";
    declare namespace bd-alg="http://www.nltaxonomie.nl/nt11/bd/20161207/dictionary/bd-algemeen";
    declare namespace bd-bedr="http://www.nltaxonomie.nl/nt11/bd/20161207/dictionary/bd-bedrijven";
    

    There was probably a confusion with the XML syntax to bind namespaces, which uses the xmlns: prefix to distinguish bindings from regular attributes:

    <link:calculationLink xmlns:link="http://www.xbrl.org/2003/linkbase">
      ...
    </link:calculationLink>
    

    In XQuery, this is not needed because the declare namespace syntax already makes it clear that these are prefixes.