db:create, namespaces not stripped when input is variable?

Thursday, 26 November 2015 · 3 messages · last reply 27 Nov 2015
HE
Hondros, Constantine (ELS-AMS)26 Nov 2015 18:48 #
Hello all, Any particular reason behind this observed behaviour? (Basex 8.3). .............................................................. [1] .............................................................. declare variable $test := <test xmlns:ce="http://www.elsevier.com/xml/ani/common" xmlns="http://www.elsevier.com/xml/ani/ani"> <ce:initials>M.S.</ce:initials> </test>;
db:create('test', $test, 'blah', map {'stripns':true()})
.............................................................. [2] ..............................................................
db:open('test')/*
.............................................................. [3] ..............................................................
<test xmlns="http://www.elsevier.com/xml/ani/ani" xmlns:ce="http://www.elsevier.com/xml/ani/common">
  <ce:initials>M.S.</ce:initials>
</test>
I would have expected the namespaces to be shredded ... Cheers, Constantine ________________________________ Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
EF
Etanchaud Fabrice27 Nov 2015 09:14 #
Hello Constantine, IMHO parsing options only apply when there is actually a parsing phase. I remember having the same problem with whitespace chopping. Would you get expected result by serializing the xml before giving it to the db:create function ? Best regards, Fabrice
Quoted text · Hondros, Constantine (ELS-AMS) · 28 lines
De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Hondros, Constantine (ELS-AMS) Envoyé : jeudi 26 novembre 2015 18:49 À : 'basex-talk at mailman.uni-konstanz.de' <basex-talk at mailman.uni-konstanz.de> Objet : [basex-talk] db:create, namespaces not stripped when input is variable? Hello all, Any particular reason behind this observed behaviour? (Basex 8.3). .............................................................. [1] .............................................................. declare variable $test := <test xmlns:ce="http://www.elsevier.com/xml/ani/common" xmlns="http://www.elsevier.com/xml/ani/ani"> <ce:initials>M.S.</ce:initials> </test>; db:create('test', $test, 'blah', map {'stripns':true()}) .............................................................. [2] .............................................................. db:open('test')/* .............................................................. [3] .............................................................. <test xmlns="http://www.elsevier.com/xml/ani/ani" xmlns:ce="http://www.elsevier.com/xml/ani/common"> <ce:initials>M.S.</ce:initials> </test> I would have expected the namespaces to be shredded ... Cheers, Constantine Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
CG
Christian Grün27 Nov 2015 12:50 #
Fabrice already gave you the answer (thanks!). As this question has not been asked for the first time, I have updated our documentation [1]. Hope this helps, Christian [1] http://docs.basex.org/wiki/Database_Module#db:create
Quoted text · Etanchaud Fabrice · 112 lines
On Fri, Nov 27, 2015 at 9:14 AM, Etanchaud Fabrice <Fabrice.Etanchaud at horanet.com> wrote: > Hello Constantine, > > > > IMHO parsing options only apply when there is actually a parsing phase. > > I remember having the same problem with whitespace chopping. > > Would you get expected result by serializing the xml before giving it to the > db:create function ? > > > > Best regards, > > Fabrice > > > > > > De : basex-talk-bounces at mailman.uni-konstanz.de > [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Hondros, > Constantine (ELS-AMS) > Envoyé : jeudi 26 novembre 2015 18:49 > À : 'basex-talk at mailman.uni-konstanz.de' > <basex-talk at mailman.uni-konstanz.de> > Objet : [basex-talk] db:create, namespaces not stripped when input is > variable? > > > > Hello all, > > Any particular reason behind this observed behaviour? (Basex 8.3). > > > > …………………………………………………….. > > [1] > > …………………………………………………….. > > declare variable $test := > > <test xmlns:ce="http://www.elsevier.com/xml/ani/common" > xmlns="http://www.elsevier.com/xml/ani/ani"> > > <ce:initials>M.S.</ce:initials> > > </test>; > > > > db:create('test', $test, 'blah', map {'stripns':true()}) > > > > …………………………………………………….. > > [2] > > …………………………………………………….. > > > > db:open('test')/* > > > > …………………………………………………….. > > [3] > > …………………………………………………….. > > > > <test xmlns="http://www.elsevier.com/xml/ani/ani" > xmlns:ce="http://www.elsevier.com/xml/ani/common"> > > <ce:initials>M.S.</ce:initials> > > </test> > > > > > > > > I would have expected the namespaces to be shredded … > > > > Cheers, > > Constantine > > > > > > > > ________________________________ > > Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The > Netherlands, Registration No. 33156677, Registered in The Netherlands.

⚡Generated with XQuery