[MarkLogic Dev General] Inserting node to xml before it is loaded in Marklogic
Geert Josten
Geert.Josten at daidalos.nl
Tue Oct 26 02:57:28 PDT 2010
Hi Pragya,
It sounds like you are looking for 'in-memory' updating of the XML. There was a small library module on XQzone that facilitated with this, but not sure where it went on github. It could also that the xqueryfunctions library (http://www.xqueryfunctions.com/) provides readily available functions that should help you with it. But it is quite trivial with your example:
let $x :=
<x>
<a>..</a>
<b>...</b>
<c>..</c>
<c>..</c>
</x>
return
element { node-name($x) } {
$x/@*,
$x/*,
<c>...</c>
}
You can use typeswitch if you need to go through your content recursively..
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
geert.josten at daidalos.nl<mailto:geert.josten at daidalos.nl>
www.daidalos.nl<http://www.daidalos.nl/>
KvK 27164984
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: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Pragya Kapoor
Sent: dinsdag 26 oktober 2010 11:33
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] Inserting node to xml before it is loaded in Marklogic
Hi,
I need to insert and element node to the following xml without inserting into ML:
<x>
<a>..</a>
<b>...</b>
<c>..</c>
<c>..</c>
</x>
I want to add another <c> element based on some condition to get the desired xml as:
<x>
<a>..</a>
<b>...</b>
<c>..</c>
<c>..</c>
<c>..</c>
</x>
Please let me know how can I do this.
Thanks,
Pragya
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20101026/12f25e58/attachment-0001.html
More information about the General
mailing list