Loading TOC...

xdmp:encode-for-NCName

xdmp:encode-for-NCName(
   $name as xs:string
) as xs:string

Summary

Invertible function that escapes characters required to be part of an NCName. This is useful when translating names from other representations such as JSON to XML. Given any string, the result is always a valid NCName. Providing all names are passed through this function the result is distinct NCNames so the results can be used for searching as well as name generation. The inverse function is xdmp:decode-for-NCName.

Parameters
$name A string which is used as an NCName (such as the localname for an element or attribute).

Example

xdmp:encode-for-NCName("A name")
=> "A_20_Name"

Comments

  • This is the function used by the "basic" strategy of json:transform-from-json() for element and attribute names generated from JSON names
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy