Hi Dean,
I kinda suspected that the local prefix wasn’t the problem, but that is hard to pinpoint without complete code. I have to admit that the error message is not helping, that would have probably saved you a lot of time. The reason why this goes wrong is because when you try to create an element from a name as string, and this name contains a prefix, then this prefix must be known within that scope. I am not sure why this worked in the older instance, but perhaps it is because that prefix and namespace were added to the Namespaces via the admin console there, but not in the new instance. There is a simple other way though. You can create an element by passing in an xs:QName instead of a string. The best way to copy an element is by using fn:node-name. Contrary to fn:name, this returns a fully qualified name instead of prefix+local-name as a string. Such QNames don’t require prefixes to be bound, since that information is contained within the xs:QName itself. So, replace fn:name with fn:node-name, and you don’t need to register Namespaces in the admin console.. Kind regards, Geert *Van:* [email protected] [mailto: [email protected]] *Namens *Dean Pullen *Verzonden:* woensdag 1 februari 2012 13:47 *Aan:* [email protected] *Onderwerp:* Re: [MarkLogic Dev General] New server not finding namespace Finally found it! You must add the meta namespace details in the admin console, via Groups, Default, Namespaces. For ages we couldn't find it because we had presumed the 'local' namespace was fault, but instead it was a namespace within the XML loaded in the XQuery. Hope this helps someone else! Dean. On 01/02/2012 12:08, Dean Pullen wrote: Hi all, This is a follow on from a previous thread. I've now constructed a test case which allows to get to the route of the problem, regarding an error on a new marklogic instance (2.4-8) that doesn't appear on an existing instance (2.4-2). The error is: *[1.0-ml] XDMP-NONAMESPACEBIND: (err:FONS0004) local:asis($node) -- No namespace binding for prefix* This occurs when using fn:name on the following: *<item doi="10.1007/s00003-009-0548-4"> <meta:volume xmlns:meta="http://www.springer.com/app/meta"<http://www.springer.com/app/meta> /></item>* - But only on the new marklogic instance. The code to replicate this is as follows: * xquery version "1.0-ml"; declare function local:asis($node as node()) as node() { element {fn:name($node)} { $node/attribute::* } }; (:~ : Main Query Block : :) let $item := <item doi="10.1007/s00003-009-0548-4"> <meta:volume xmlns:meta="http://www.springer.com/app/meta"<http://www.springer.com/app/meta> /></item> return local:asis($item/node()) * The solution is to add the meta namespace explicitly, like so: *declare namespace meta = "http://www.example.com/app/meta"<http://www.example.com/app/meta> ;* But why do you only have to do this on the new server instance and not the old?! Is there somewhere to set up namespaces for use without the prefix? Many thanks, Dean Pullen _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
