(no subject)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

(no subject)

Alfredo Cosco
Hi all,
I'm using exist-db 2.2 stable

I have a collection of documents with a markup like this:

<mydocument>
    <meta>
        <doctitle>Lorem ipsum 2</doctitle>
    </meta>
    <text>Dolor sit amet</text>
</mydocument>

Now I have to add an xmlns attribute to document root, like this:

<mydocument xmlns="blah">

After a day of troubles I discovered that xmlns in the root element is not editable/updatable/replaceable without rewriting the document so I managed something dirty and easy like this:
------------------------------------------------------------------------------
let $doc:= doc("/db/apps/myapp/data/test/doc.xml")
let $old:= $doc/mydocument/*

let $new :=<mydocument xmlns="blah">{$old}</mydocument>

let $store:=xmldb:store("/db/apps/ratest/data/test/", "doc.xml", $new)

return
 $doc
-------------------------------------------------------------------------------

Wow, the result in eXide console is wonderful:
<mydocument xmlns="blah">
  <meta>
    <doctitle>Lorem ipsum 2</doctitle>
  </meta>
  <doctitle>Lorem ipsum 2</doctitle>
  <text>Dolor sit amet</text>
</mydocument>

but when I open the file in the editor it is like this:

<mydocument xmlns="blah">
    <meta xmlns="">
        <doctitle>Lorem ipsum 2</doctitle>
    </meta>
    <text xmlns="">Dolor sit amet</text>
</mydocument>

As you can see there are empty xmlns attributes on the children of the root.

Why? How can I avoid this? 

Thanks,
Alfredo




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...