xdmp.keyFromQName( name as xs.QName ) as String
Construct a context-independent string from a QName. This string is of the form "{namespaceURI}localname" and is suitable for use as a map key.
Parameters | |
---|---|
name | The QName to compute a key for. |
// Using a QName with an in-scope namespace prefix 'use strict'; xdmp.keyFromQName('xs:string'); // Returns output of the following form: // {http://www.w3.org/2001/XMLSchema}string // // The generated key includes the XMLSchema namespace URI because the // "xs" namespace binding is implicitly defined in MarkLogic.
// Using a key based on an arbitrary namespace 'use strict'; xdmp.keyFromQName(fn.QName('/my/namespace', 'thing')); // Returns output of the following form: // {/my/namespace}thing
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.