[MarkLogic Dev General] xdmp:unquote issues in 1.0-ml: "invalid root text"

Michael Blakeley michael.blakeley at marklogic.com
Fri Apr 24 13:00:49 PDT 2009


Eric,

The change is in the release notes 
(http://developer.marklogic.com/pubs/4.0/books/relnotes.pdf):

> 4.2.10
> repair Option of xdmp:document-load, xdmp:unquote, and Others
> Now Default to none in 1.0 and 1.0-ml
> In the 1.0 and 1.0-ml dialects, the default for XML repairing
 > option is now none instead of full.

You can still supply the 'repair-full' option in 1.0-ml, if you wish.

For your second test, with the extra element wrapper, xdmp:describe() is 
your friend:

let $value := <value>one &lt;b&gt;two&lt;/b&gt; three</value>
return xdmp:describe(
   xdmp:unquote(concat('<t>', $value/node(), '</t>')) )
=>
document{<t>one <b>two</b> three</t>}

Per docs 
(http://developer.marklogic.com/pubs/4.0/apidocs/Extension.html#xdmp:unquote), 
xdmp:unquote() returns document-node()+. This is similar to the behavior 
of fn:doc(), fn:collection(), etc.

-- Mike

On 2009-04-24 12:43, Eric Palmitesta wrote:
> Anyone know what's changed in xdmp:unquote when moving from 0.9-ml to
> 1.0-ml?
>
> xquery version "0.9-ml"
> let $value :=<value>one&lt;b&gt;two&lt;/b&gt; three</value>
> return xdmp:unquote($value/node())
> =>
> <v:results v:warning="more than one node">
>     one
>     <b>two</b>
>     three
> </v:results>
>
> xquery version "1.0-ml";
> (: same code as above :)
> let $value :=<value>one&lt;b&gt;two&lt;/b&gt; three</value>
> return xdmp:unquote($value/node())
> =>
> [1.0-ml] XDMP-DOCROOTTEXT: xdmp:unquote("one<b>two</b>  three") --
> Invalid root text "one "
>
> This works:
>
> xquery version "1.0-ml";
> let $value :=<value>one&lt;b&gt;two&lt;/b&gt; three</value>
> return xdmp:unquote(concat('<t>', $value/node(),'</t>'))
> =>
> <t>
>     one
>     <b>two</b>
>     three
> </t>
>
> However, appending /node() doesn't change the output.  I would expect
> <t>  and</t>  to vanish:
>
> xquery version "1.0-ml";
> let $value :=<value>one&lt;b&gt;two&lt;/b&gt; three</value>
> return xdmp:unquote(concat('<t>', $value/node(),'</t>'))/node()
> =>
> <t>
>     one
>     <b>two</b>
>     three
> </t>
>
> These examples were run on CQ, using MarkLogic 4.0-3, linux x86_64.
>
> Eric
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general



More information about the General mailing list