I am looking at the new 7.3 XML format commands and some things that are not clear to me in the documentation. My particular goal is to create a new database ensuring CHOP is off. There is a Rest syntax example that is exactly what I want at http://docs.basex.org/wiki/REST *<command xmlns="http://basex.org/rest">* * <text>create db test http://files.basex.org/xml/xmark.xml</text>* * <option name='chop' value='false'/>* *</command>*
except I want to use the client module http://docs.basex.org/wiki/Client_Module.
Can client:execute module use the XML syntax? And if so does the XML syntax <create-db name='...'> Have a way to specify options? Or should I use multiple commands starting with <set option='CHOP'>OFF</set>
These links http://docs.basex.org/wiki/Commands#XML_Syntax http://docs.basex.org/wiki/Commands#CREATE_DB are not making it completely clear to me. /Andy
Hi Andy,
I am looking at the new 7.3 XML format commands and some things that are not clear to me in the documentation. [...]
thanks for the hint. If you have some ideas how the documentation could be improved… your edits are more than welcome!
I want to use the client module http://docs.basex.org/wiki/Client_Module.
the following query should do what you need:
let $c := client:connect( ... ) return ( client:execute($c, 'set chop off'), client:execute($c, 'create db test http://files.basex.org/xml/xmark.xml'), client:execute($c, 'set chop on') )
Currently, the client module only allows single commands per client:execute call. These commands can even be represented as xml (in most cases, though, this won't make too much sense):
client:execute($c, '<info/>')
However, one reason we introduced the new XML command syntax is that we want to make our command interface more powerful. In future versions, we plan to..
– integrate the XML command into our existing REST API – represent "transactions" (several commands) that will be atomically executed – provide simple boolean operators to decide if a second command will be executed if the one fails. the syntax could be extended to conditional stuff (if/then/else) and other basic coding paradigms.
More ideas are welcome, Christian
basex-talk@mailman.uni-konstanz.de