Thanks for the response Michael. I'm using Xerces and spitting out the DOM using XMLSerializer. I'm invoking the query through the run() method.
Anyway the problem seems to have solved itself (worryingly...). I had changed my prototype to use StreamResult to work around this, then went back to DOMResult after reading your reply and all seems well. Can't have been anything different in the serialization because that code did not change. If I figure out what it was I'll post a reproducible test case for you to examine.
-----Original Message-----
From: Michael Kay []
Sent: March 4, 2005 11:25
Subject: RE: [saxon] DOMResult stripping namespaces from root element?

This is working fine for me.
I wonder
(a) what DOM implementation you are using (I tested on Xerces)
(b) how are you actually reading the DOM, that leads you to the conclusion the namespaces are absent?
(c) how are you invoking the query?
Michael Kay

From: [] On Behalf Of Dueck, Brian
Sent: 04 March 2005 14:02
Subject: [saxon] DOMResult stripping namespaces from root element?


I'm getting some strange behaviour related to namespaces when getting results using a DOMResult vs a StreamResult.

To elaborate, I'm using Saxon8B to process some a simple Xquery expressions using and returning the results as a DOMResult. When I do this, none of the namespace declarations from the root element of my returned documented are available when I call DOMResult.getNode(). However if I change from DOMResult to StreamResult and serialize this out to System.out (or whatever) I see them just fine.

Is this behaviour expected?

To reproduce this, just try passing the following XML document (no special xquery syntax at all here in this test case) to

<soap:Envelope xmlns:mrns0=""        xmlns:soap="" xmlns:soapenc=""        xmlns:xsi="">

        <soap:Body soap:encodingStyle="">
                        <username xsi:type="soapenc:string">junk_user_name</username>

Using DOMResult in my case is *really* preferable as the results of the xquery run need to be passed to another component that is expecting a dom node. I don't really want to have to reparse the serialized xml available from StreamResult back into a DOM to avoid the performance hit.

Any, all, help is appreciated.



Discover the Power of MetaSolv
Subscribe to our Company Newsletter

Discover the Power of MetaSolv
Subscribe to our Company Newsletter