Add more namespace to document in baseX

Tuesday, 22 July 2014 · 2 messages
NM
nguyen my22 Jul 2014 11:32 #
Hello all. I have a problem I have a document : <otx xmlns="http://iso.org/OTX/1.0.0" xmlns:math=" http://iso.org/OTX/1.0.0/Math"> <..> </otx> I want to add more namespace to the otx tag. I use a query is:
declare default element namespace "http://iso.org/OTX/1.0.0";
for $otx in collection()/otx
return replace node $otx with
<otx
 xmlns="http://iso.org/OTX/1.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
 xmlns:diag="http://iso.org/OTX/1.0.0/DiagCom"
 xmlns:quant="http://iso.org/OTX/1.0.0/Quantities"
 xmlns:event="http://iso.org/OTX/1.0.0/Event"
 ...
Quoted text · 1 line
>
{$otx/@*}
{
   $otx/metaData, $otx/specification,$otx/adminData,$otx/imports,
   $otx/declarations,
   $otx/validities, $otx/signatures,
   for $p in  $otx/procedures
   let $r:= $p/realisation
   return     $p
}
</otx>
but it run very slow if the database is pretty largely. Please help me for a best solution. Thanks so much!
SA
Sergey Alekhin22 Jul 2014 12:03 #
Maybe this will help or something like:
declare default element namespace " <http://iso.org/OTX/1.0.0> http://iso.org/OTX/1.0.0";

let $newData := for $otx in collection()/otx return

<otx
Quoted text · nguyen my · 1 line
>
{$otx/@*}
{

   $otx/metaData, $otx/specification,$otx/adminData,$otx/imports,

   $otx/declarations,

   $otx/validities, $otx/signatures,

   for $p in  $otx/procedures

   let $r:= $p/realisation
return $p }
</otx>
return ( delete node collection()/otx, insert node $newData into collection()/ )
Quoted text · basex-talk-bounces at mailman.uni-konstanz.de · 35 lines
From: basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] On Behalf Of nguyen my Sent: Tuesday, July 22, 2014 1:32 PM To: basex-talk at mailman.uni-konstanz.de Subject: [basex-talk] Add more namespace to document in baseX Hello all. I have a problem I have a document : <otx xmlns="http://iso.org/OTX/1.0.0" xmlns:math="http://iso.org/OTX/1.0.0/Math"> <..> </otx> I want to add more namespace to the otx tag. I use a query is: declare default element namespace "http://iso.org/OTX/1.0.0"; for $otx in collection()/otx return replace node $otx with <otx xmlns="http://iso.org/OTX/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:diag="http://iso.org/OTX/1.0.0/DiagCom" xmlns:quant="http://iso.org/OTX/1.0.0/Quantities" xmlns:event="http://iso.org/OTX/1.0.0/Event" ... > {$otx/@*} { $otx/metaData, $otx/specification,$otx/adminData,$otx/imports, $otx/declarations, $otx/validities, $otx/signatures, for $p in $otx/procedures let $r:= $p/realisation return $p } </otx> but it run very slow if the database is pretty largely. Please help me for a best solution. Thanks so much!

⚡Generated with XQuery