> serialize(<Basex Database Name>/<folder name>/<xml file name>.xml , > map { > 'method' : 'xml' > 'xml' : map { 'doctype-system' : '<!DOCTYPE testSuiteConfig SYSTEM > "../../../configs/TestConfig_2_1.dtd">', 'omit-xml-declaration' : 'no' } > } > )
There are various ways to specify the serialization parameters. If you assign options in the query prolog, there is no need to call serialize: declare namespace output = 'http://www.w3.org/2010/xslt-xquery-serialization'; declare option output:omit-xml-declaration 'no'; declare option output:doctype-system '../../../configs/TestConfig_2_1.dtd'; db:open('db', 'path/to/file.xml') If you invoke serialize, a valid item must be supplied as first argument for serialize. This can e.g look as follows: serialize(db:open('db', 'path/to/file.xml'), map { ... }) > From: Christian Grün <christian.gr...@gmail.com> > Sent: Tuesday, July 28, 2020 9:27 PM > To: Srikumar Choudhury <schou...@opentext.com> > Cc: James Ball <basex-t...@jamesball.co.uk>; BaseX > <basex-talk@mailman.uni-konstanz.de> > Subject: Re: [EXTERNAL] - Re: [basex-talk] BaseX 9.4 - XQuery locks - > documentation query > > Hi Srikumar, > > As document type definitions and XML declarations are not part of the > XML information set, they are not stored in the database. However, you > can easily recreate them when serializing your documents. See [1] for > further information. > > Hope this helps > Christian > > [1] > https://urldefense.com/v3/__https://www.w3.org/TR/xml-infoset/__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AVy7d0PwQ$ > [2] > https://urldefense.com/v3/__https://docs.basex.org/wiki/Serialization__;!!Obbck6kTJA!OZeMfuu_v5bg2MlWBgvOV5Cz4kfvZzejlmLdia84fV9ScLMuUO5R91AP4AWXSI7EQA$ > > > > On Tue, Jul 28, 2020 at 5:49 PM Srikumar Choudhury > <schou...@opentext.com> wrote: > > > > Hi, > > <!DOCTYPE some name SYSTEM .. and <?xml version="1.0"?> data loss are > > happening while importing the xml document using db:replace(...) API. > > > > <?xml version="1.0"?> > > > > <!DOCTYPE testSuiteConfig SYSTEM "../../../configs/TestConfig_2_1.dtd"> > > etc. > > We need help to resolve this issue. > > we are using Java executeQuery api of XQExpression. class to run > > "db:replace(...)" query to store document in Basex database, but while > > retrieving the XML files from basex server we notice data loss. we can loss > > above data. > > > > Please help us, how we can resolve this issue or share some documentation, > > which can help to resolve this issue. > > > > Thanks, > > Srikumar