Create a document in a created database

Monday, 20 April 2020 · 3 messages
RH
Ramzi Hammouda20 Apr 2020 12:55 #
Hello BaseX team, This may sound simple, but didn't find how to do it, what is the xquery for creating an empty xml document in a chosen database. Thanks. P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. Let's respect the environment together. Only print this message if necessary.
OS
Omar Siam20 Apr 2020 13:24 #
That may not answer your question but I create DBs using a dummy xml und replace the whole (and only) file later:
db:create("`{$new-db-name}`", document {<_ xmlns=""></_>},
"`{$new-db-name}`.xml", $index-options)
Quoted text · Ramzi Hammouda · 13 lines
Am 20.04.2020 um 12:55 schrieb Ramzi Hammouda: > > Hello BaseX team, > > This may sound simple, but didn’t find how to do it, what is the > xquery for creating an empty xml document in a chosen database. > > Thanks. > > > P/Respectons ensemble l'environnement. N'imprimez ce message que si > nécessaire. //Let's respect the environment together. Only print this > message if necessary./
CG
Christian Grünin reply to Ramzi Hammouda, 20 Apr 2020, 12:5520 Apr 2020 14:22 #
Dear Ramzi, As Omar has stated, you can use XQuery to create a database with an initial empty document:
  db:create('db', <xml/>, 'doc.xml')
A new empty document can be added to an existing database as follows:
  db:add('db', <xml/>, 'doc.xml')
See more examples in our documentation [1]. You can also use BaseX commands to create, add or replace documents [2]. Best, Christian [1] https://docs.basex.org/wiki/Database_Module [2] https://docs.basex.org/wiki/Commands
Quoted text · Ramzi Hammouda · 11 lines
On Mon, Apr 20, 2020 at 12:56 PM Ramzi Hammouda <Ramzi.Hammouda at se.linedata.com> wrote: > > Hello BaseX team, > > This may sound simple, but didn’t find how to do it, what is the xquery for creating an empty xml document in a chosen database. > > Thanks. > > > P Respectons ensemble l'environnement. N'imprimez ce message que si nécessaire. Let's respect the environment together. Only print this message if necessary.

⚡Generated with XQuery