I have huge number of data and in that I have .svg file format as well, which has xlink namespace, but a few of the svg doc do not have xlink namespace and these documents have to be skipped while loading into MarkLogic.
So, which function can I use to read the namespace to filter or restrict while reading the data from file system.
I am using xdmp:document-get("file path") to read the doc from file system.
Sample xml with xlink NS -
<Books xmlns="http:books.com" xmlns:xlink="http://www.w3.org/1999/xlink">
<book/>
</Books>
Sample xml without xlink NS -
<Books xmlns="http:books.com" >
<book/>
</Books>
@Vlad Rose answer should work in most cases. However, it relies upon the instance document having the
xlinknamespace-prefix. It might not bexlink, but still be the xlink namespace-uri. For instance:xmlns:x="http://www.w3.org/1999/xlink"You could instead use the
namespace::axis and test if any of the namespaces have thexlinknamespace-uri "http://www.w3.org/1999/xlink" like this: