Yes it is somewhat equivalent.
I modified it a little bit, to test the update. Devicehelp doesn't seem get updated with this command.
<commands> <create-db name="en-us"/> <add path="devicehelp.xml"> <menu id="devicehelp"/> </add> <add path="smbonly.xml"> <menu id="smbonly"/> </add> <add path="ptt-help.xml"> <menu id="ptt-help"/> </add> <xquery><![CDATA[ db:replace('en-us', 'devicehelp.xml', <menu id="new"/>) ]]></xquery> <list name="en-us"/> </commands>
for $x in /*
return $x/data(@id)
gets me: devicehelp smbonly ptt-help
On Sat, Jan 5, 2013 at 4:33 AM, Christian Grün christian.gruen@gmail.comwrote:
Baril,
sorry, but I’m still not sure how to reproduce your use case.
let $raw-menu := app:open-db('en-us')/menu[@id = $menu-id]
Is app:open-db(...) equivalent to db:open(...) ?
Do you think that the following script is equivalent to what you do via RESTXQ?
<commands> <create-db name='en-us'/> <add path='devicehelp.xml'><menu id="devicehelp"/></add> <add path='smbonly.xml'><menu id="smbonly"/></add> <add path='ptt-help.xml'><menu id="ptt-help"/></add> <xquery><![CDATA[ db:replace('en-us', 'devicehelp.xml', <menu id="devicehelp"/>) ]]></xquery> <list name='en-us'/> </commands>
You can save this script using the ".bxs" suffix, and open and run it via the GUI or on command-line (basex script.bxs).
Christian