Paul,
What version of the server are you running? Automatic serialization/deserialization is a feature of MarkLogic 4.x. If you happen to be running 3.2, now would be a good time to upgrade? :) Otherwise, there is a lib-parser module buried within lib-search in the workshop (http://xqzone.marklogic.com/svn/lib-search/trunk/release/lib-parser.xqy). There you will find the functions lp:serialize-cts-query() and lp:deserialize-query() that may provide what you need. Note that there are some minor incompatibilities between the format used by lib-parser and the format baked into the server in 4.x. Just keep that in mind when it's time to upgrade. --Mark _____ From: [email protected] [mailto:[email protected]] On Behalf Of Wayne Feick Sent: Thursday, September 24, 2009 4:48 PM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] general serialization of cts All of the cts queries serialize/deserialize as a feature of the server. Placing a query into an element turns it into its xml representation, and the cts:query() constructor turns the xml representation back into a query. let $cts-e as cts:query := cts:word-query("tilt", ("lang=en"), 1) let $cts-e-q := <outside-tag>{$cts-e}</outside-tag> let $cts-e2 := cts:query($cts-e-q/element()) return ($cts-e2, xdmp:describe($cts-e2)) On Thu, 2009-09-24 at 13:28 -0700, Paul M wrote: let $dc as element() := <fff>123</fff> let $dc-q := <outside-tag>{xdmp:quote($c)}</outside-tag> let $dc-qt := $dc-q/text() let $dc-uq as element():= xdmp:unquote($dc-qt,"","format-xml")/node() let $cts-e as cts:query := cts:word-query("tilt", ("lang=en"), 1) let $cts-e-q := <outside-tag>{xdmp:quote($cts-e)}</outside-tag> let $cts-e-qt := $cts-e-q/text() let $dc-uq as cts:query:= xdmp:unquote($cts-e-qt,"","format-xml")/node() cast as cts:query (:this does not work:) return $cts-e-q The $dc-uq stmt does not work. Cast exception. I am attempting to create general method to serialize any cts:query without using lib parser. Even possible? xdmp:quote works on any item,correct?
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
