e4x object missing inScopeNamespaces()

<"neil.stansbury () redbacksystems ! com"@lists.mozilla.org> Fri, 04 Sep 2009 09:54:55 +0100
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
Hi all,

As I understand it, the toXMLString() method of an e4x object should preserve a valid xml snippet?

Eg.  This should work

var o2 = XML( o1.toXMLString() );


However, when I try the following ( 1.9.2a2pre ) I get an "invalid XML namespace error"

The XML:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
     <NS1:soapHeader xmlns:NS1="urn:types:soapheader">false</NS1:soapHeader>
   </soap:Header>
</soap:Envelope>


The JS:

var env = XML( [the string above] );

var nodes = env..*;

alert( nodes[ 1 ].inScopeNamespaces() ); // alerts: http://schemas.xmlsoap.org/soap/envelope/

var xmlString = nodes[ 1 ].toXMLString();

alert( xmlString ); 			// alerts <soap:Header> node string

var e4x = XML( xmlString );		// Error invalid XML namespace soap


This fails even though the namespace is returned as in scope for this object.  The only workaround I have is to loop through and redeclare the 
in scope namespaces of the root object being exported.

Could someone sanity check for me before I submit a bug


Cheers,

Neil