Loading TOC...


   [$dbid as xs:unsignedLong]
) as Element()


Returns the list of path namespaces for the given database id.

$dbid The id for the database to get the path namespaces for. Empty for the current database.


xquery version "1.0-ml";


=> List of path-namespaces defined on Documents

<path-namespaces xmlns="http://marklogic.com/xdmp/database">

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


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • I want to get all the existing namespaces in my database, and the query is not returning them. Thanks. xquery version "1.0-ml"; xdmp:database-path-namespaces(xdmp:database("hcp4-1-13")) result <path-namespaces xmlns="http://marklogic.com/xdmp/database"/>
    • This function only returns path namespaces that you have configured for the database. Maybe you have not configured any? You need these to configure path fields and path range indexes.
      • Thanks for the quick answer. Probably I am confusing things. I am displaying an object and I can see a namespace declaration xmlns:r query: doc("/$RESOURCE$/100/res-14.xml") result: <?xml version="1.0" encoding="UTF-8"?> <r:res r:id="14" xmlns:r="http://www.rsuitecms.com/rsuite/ns/metadata"><r:md> <r:id>14</r:id> ..... I need a query to get all our namespaces like this one http://www.rsuitecms.com/rsuite/ns/metadata. Is that possible? is it really a namespace?
        • You can do that with XPath. The path-namespaces api returns database configuration, not data from your document. Here is a way to do something like that in XPath (there are other ways too): let $node := <r:res r:id="14" xmlns:r="r-namespace"> <r:md> <r:id>14</r:id> </r:md> </r:res> return $node/namespace::* => namespace{"r"}{"r-namespace"} namespace{"xml"}{"http://www.w3.org/XML/1998/namespace"}