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

Eric Palmitesta eric.palmitesta at utoronto.ca
Fri Apr 24 13:13:27 PDT 2009


Sorry Michael, I should have taken a closer look at the release notes.

xquery version "1.0-ml";
let $value := <value>one &lt;b&gt;two&lt;/b&gt; three</value>
return xdmp:unquote($value/node(), "repair-full")

This produces the same error as without the "repair-full" parameter.  I 
have a feeling I'm just making a silly mistake here.

Eric

Michael Blakeley wrote:
> 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
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general


More information about the General mailing list