To follow up on my previous email, we observe the following.

We run a query:

declare namespace libx='http://libx.org/xml/libx2';
declare namespace atom='http://www.w3.org/2005/Atom';
declare variable $entry as xs:anyAtomicType external;
declare variable $id    as xs:string external;
declare variable $feed  as xs:anyAtomicType := doc('libx2_feed')/atom:feed;
delete node $feed/atom:entry[atom:id=$id],
(: INVESTIGATE: this results in wrong xmlns entries :)
insert node $entry into $feed

whereby we bind 'entry' to a DOM node using the org.w3c. Implementation.

When we print the about-to-be-inserted entry from Java code  prior to insertion, we see:

<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:libx="http://libx.org/xml/libx2">
  <id>3</id>
(rest omitted)

If we run a database dump via the org.basex.BaseX program (query: doc('libx2_feed')) right after the update, we see this:

<entry xmlns="" xmlns="http://www.w3.org/2005/Atom" xmlns:libx="http://libx.org/xml/libx2">
  <id>3</id>
  <title> (rest omitted)

Other than the spurious 'xmlns=""', the rest looks ok.

It seems to me that BaseX should never allow two default namespace prefixes for any element.

 - Godmar