Loading TOC...

MarkLogic 10 Product Documentation
admin.appserverAddNamespace

admin.appserverAddNamespace(
   config as element(configuration),
   appserver-id as (Number|String),
   namespaces as element(gr.namespace)[]
) as element(configuration)

Summary

Add one or more namespaces to an App Server configuration, which will predefine the namespace(s) for all requests evaluated against the App Server.

Parameters
config The configuration for the cluster, typically the result of admin:get-configuration() call.
appserver-id The ID of the App Server. Typically, this is the result of an admin.appserverGetId call.
namespaces

A list of namespaces to add. Each namespace specification has the following form:


  <namespace xmlns="http://marklogic.com/xdmp/group">
    <prefix>myprefix</prefix>
    <namespace-uri>http://myuri/forthisprefix</namespace-uri>
  </namespace>
	 
Typically the result of an admin:group-namespace call.

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/admin/app-server

http://marklogic.com/xdmp/privileges/admin/app-server/{id}

http://marklogic.com/xdmp/privileges/admin/group

http://marklogic.com/xdmp/privileges/admin/group/{id}

Example


  let admin = require("/MarkLogic/admin.xqy");
  let config = admin.getConfiguration()
  admin.appserverAddNamespace(config,
    admin.appserverGetId(config,[], "Docs"),
    fn.head(xdmp.unquote('<namespace xmlns="http://marklogic.com/xdmp/group">\
      <prefix>myprefix</prefix>\
      <namespace-uri>http://myuri/forthisprefix</namespace-uri>\
    </namespace>')).root)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.