Loading TOC...

xdmp:pretty-print

xdmp:pretty-print(
   $xquery as xs:string
) as xs:string

Summary

Returns a well-formatted XQuery module.

Parameters
$xquery An XQuery module to be reformatted.

Example

xdmp:pretty-print("for $x in 1 to 10 return $x")
=> "for $x in 1 to 10
    return $x"

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

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • It seems declare is being removed when you declare a default function namespace. Also, is there a particular reason behind comments being removed? I was just looking at making use of this function as part of my development process, but comments are hard enough to come by, I would hate remove the ones I do have. :)
    • I reproduced and filed a bug for the declare being dropped. As for the comments being removed, that is because the comments are not part of the XQuery data model, so they do not exist when xdmp:pretty-print is run. We have an RFE in the system about it, though.