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
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Dueck, Brian
Sent: 04 March 2005 14:02
To: saxon-help@lists.sourceforge.net
Subject: [saxon] DOMResult stripping namespaces from root element?

Hi;

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 XQueryExpression.run() 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 XQueryExpression.run():

<soap:Envelope xmlns:mrns0="http://yahoouserping.webservice.allesta.org"        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                <mrns0:isUserOnLine>
                        <username xsi:type="soapenc:string">junk_user_name</username>
                </mrns0:isUserOnLine>
        </soap:Body>
</soap:Envelope>

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.

Regards,

Brian.


Discover the Power of MetaSolv
Subscribe to our Company Newsletter