So I wrote a couple of little functions:
1) deleteUnusedNS(Node n)
which is a modification of code I found at cocoondev.org (I think). You just give it an org.w3c.dom.Node and
it recursively removes all namespace declarations (attributes with prefix xmlns: ) for which there are no nodes or
attributed that need them. This is useful because the current Xindice implementation adds the ns declaration
xmlns:src="http://......" into *every* element, whether is needed or not. I don't know if they are trying to fix that.
2) deleteAttributesUnderNS (Node node, String nsURI)
You give it a Node and a namespace URI (for example, the aforementioned "http://xml.apache.org/xindice/Query"
and it recursively deletes all attributes that belong to that namespace.
If you apply these funcions in order (2) then (1) you end up with a clean document, the way it should be :-)
You still get the document inside the <xapi:....> tags but you say you need those.
I can provide you with the code if you want it. It uses just DOM, I seem to remember.
It was my first attempt at any real DOM programming so it may be full of inefficiencies but it works for my needs.
BarZ
----------------------------------------------------
ATENCION
Su servicio de correo tiene antivirus ??
@internet URUGUAY: http://www.internet.com.uy