[MarkLogic Dev General] New server not finding namespace
Dean Pullen
dean.pullen at semantico.com
Wed Feb 1 05:26:00 PST 2012
Geert,
Yes the error was a bit of red herring, making me believe it was a local
namespace problem as opposed to the meta namespace.
Many thanks for your reply - I will take note.
Regards,
Dean.
On 01/02/2012 13:24, Geert Josten wrote:
>
> 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:*general-bounces at developer.marklogic.com
> <mailto:general-bounces at developer.marklogic.com>
> [mailto:general-bounces at developer.marklogic.com
> <mailto:general-bounces at developer.marklogic.com>] *Namens *Dean Pullen
> *Verzonden:* woensdag 1 februari 2012 13:47
> *Aan:* general at developer.marklogic.com
> <mailto:general at developer.marklogic.com>
> *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
> General at developer.marklogic.com <mailto:General at developer.marklogic.com>
> http://developer.marklogic.com/mailman/listinfo/general
>
>
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120201/86ccdda3/attachment-0001.html
More information about the General
mailing list