简体   繁体   English

MarkLogic:使用XQuery将XML文档转换为XML字符串

[英]MarkLogic: Converting an XML document into an XML string using XQuery

I am using something like 我正在使用类似的东西

let $x := 
 "<root>
 <parent1>value1</parent1>
 <parent2>value2</parent2>
 </root>"
...

and converting the XML document to string. 并将XML文档转换为字符串。 I wanted to pass an xml output from a function to another function as a string and not by hard coding it as I'm doing it right now. 我想将一个函数的xml输出作为字符串传递给另一个函数,而不是像现在那样对它进行硬编码。

I tried using fn:string , but that doesn't pick up the xml tags as string. 我尝试使用fn:string ,但是不会将xml标签作为字符串。

I think you simply want the opposite of xdmp:unquote - which is called xdmp:quote 我认为您只是想要xdmp:unquote的反面-称为xdmp:quote

xquery version "1.0-ml";    
let $x := xdmp:quote(<root>
         <parent1>value1</parent1>
         <parent2>value2</parent2>
         </root>)

return $x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM