Hi Ling,

The let $new is followed by three literal node constructors, one for the 
XML-pi, one for the comment and one for the root element and its contents. You 
need to put those in a sequence if you want to assign it to the variable, or 
wrap the tree in a document node constructor.

But in your example you are not using the xml pi, nor the comment, so why would 
you need those?

Also, you say you read the xml file as a string, but in your xquery code it is 
not quoted (which I don't recommend either). Are you copy and pasting it into 
your xquery? Have you thought about reading it from filesystem using 
xdmp:filesystem-file?

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant


Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984

P Please consider the environment before printing this mail.
De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Ling Ling
> Sent: woensdag 24 maart 2010 11:21
> To: [email protected]
> Subject: [MarkLogic Dev General] let clause with unexpected
> comment tag error
>
> Hello,
>
> I am doing update using other xml file as resources. I
> reading in xml file as a string, then I do
>
> let $new := <?xml version="1.0" encoding="US-ASCII"?><!--
> comment here
> --><Customer
> id="1011"><Mnemonic>BenzmullerLefteris</Mnemonic><ShortNames><
> ShortName>shortname1</ShortName><ShortName>shortname2</ShortNa
> me></ShortNames><Name><Title>Sir</Title><FirstName>Lefteris</F
> irstName><LastName>Benzmuller</LastName></Name><DateOfBirth>19
> 70-03-02</DateOfBirth><Gender>Male</Gender><Nationality>Syrian
> Arab
> Republic</Nationality><CountryOfResidence>Belgium</CountryOfRe
> sidence><Languages><Language>language1</Language><Language>lan
> guage2</Language></Languages></Customer>
>
> for $old in doc()
> where $old/Customer/@id eq 1003
> return (
> xdmp:node-replace(doc(fn:document-uri($old))/Customer/ShortNam
> es/ShortName[1],
> $new/ShortNames/ShortName[1]),
> xdmp:node-replace(doc(fn:document-uri($old))/Customer/Name/Title,
> $new/Name/Title)
> )
>
> The let clause has unexpected comment tag error, so I delete
> the version and comments before passing the string to let
> clause. Is there any better way to deal with this? Thank you
> very much!
>
> Best,
> Ling
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to