Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you convert a string to a node in XQuery?

I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node?

So, given an XQuery method:

define function foo($bar as node()*) as node() {
  (: unimportant details :)
}

I have a string that I want to pass to the foo method. How do I convert the string to a node so that the method will accept the string.

like image 1000
Sixty4Bit Avatar asked Sep 23 '08 14:09

Sixty4Bit


1 Answers

MarkLogic solutions:

The best way to convert a string into a node is to use:

xdmp:unquote($string).

Conversely if you want to convert a node into a string you would use:

xdmp:quote($node).

Language agnostic solutions:

Node to string is:

fn:string($node)
like image 63
Sixty4Bit Avatar answered Sep 28 '22 20:09

Sixty4Bit