CDATA is not a node, it's just syntactic sugar.  There
is never a CDATA node stored in the database.  CDATA is a
simply a means of escaping input characters.  It would be
a lot easier to just do it like this:

xdmp:node-insert-child(doc('/resources/lists/editions.xml')/Root, <Item 
Name="zz"/>)

   If you need to put arbitrary characters as the value of the
"Name" attribute, don't use string concatenation and CDATA to
construct the element.  The preferred method is to use external
variables to pass the value in, then you don't need to worry about
character escaping:

xquery version "1.0-ml";

declare variable $name external;

xdmp:node-insert-child(doc('/resources/lists/editions.xml')/Root, <Item Name="{ 
$name }"/>)


On Jul 26, 2013, at 11:55 AM, Mariano Grau Calín <[email protected]> wrote:

> This code inserts the CDATA as a literal. I need insert CDATA as a node.
>  
> Un saludo,
>  
> Mariano Grau
> mgrau @ grupojoly.com
> Dpto. Sistemas
> Grupo Joly
>  
> 
> De: [email protected] [mailto:[email protected]] 
> Enviado el: viernes, 26 de julio de 2013 10:12
> Para: [email protected]; Mariano Grau Calín
> Asunto: RE: Diferences between 0.9-ml and 1.0-ml
> 
> Hi Mariano
>  
> Try this.
>  
> xquery version "1.0-ml";
>  
> xdmp:node-insert-child(doc('/resources/lists/editions.xml')/Root, <Item 
> Name="&lt;![CDATA[zz]]&gt;"/>)
>  
> Regards,
> Asit Nautiyal
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Mariano Grau 
> Calín
> Sent: Friday, July 26, 2013 1:07 PM
> To: [email protected]
> Subject: [MarkLogic Dev General] Diferences between 0.9-ml and 1.0-ml
>  
> Hi,
>  
> I have a xquery code in 0.9-ml that works fine. However, i can not find how 
> to write in 1.0
>  
> xquery version '0.9-ml'
> xdmp:node-insert-child(doc('/resources/lists/editions.xml')/Root, <Item 
> Name={<![CDATA[zz]]>}/>)
>  
> Ok
>  
> xquery version '1.0-ml';
> xdmp:node-insert-child(doc('/resources/lists/editions.xml')/Root, <Item 
> Name={<![CDATA[zz]]>}/>)
>  
> [1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, 
> unexpected Junk_, expecting TagQName_
>  
>  
>  
> Regards,
>  
> Mariano Grau
> mgrau @ grupojoly.com
> Dpto. Sistemas
> Grupo Joly
>  
> This e-mail and any files transmitted with it are for the sole use of the 
> intended recipient(s) and may contain confidential and privileged 
> information. If you are not the intended recipient(s), please reply to the 
> sender and destroy all copies of the original message. Any unauthorized 
> review, use, disclosure, dissemination, forwarding, printing or copying of 
> this email, and/or any action taken in reliance on the contents of this 
> e-mail is strictly prohibited and may be unlawful. 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to