Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

e4x object missing inScopeNamespaces()

3 views
Skip to first unread message

Unknown

unread,
Sep 4, 2009, 4:54:55 AM9/4/09
to
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

Boris Zbarsky

unread,
Sep 4, 2009, 9:11:43 AM9/4/09
to
neil.stansbury () redbacksystems ! com wrote:
> alert( xmlString ); // alerts <soap:Header> node string

Sure seems like a bug; toXMLString specifies that [[InScopeNamespaces]]
should be serialized on the object.

That said, this is a JS engine bug, not a Gecko XML bug.

-Boris

Unknown

unread,
Sep 4, 2009, 11:02:46 AM9/4/09
to
> Sure seems like a bug; toXMLString specifies that [[InScopeNamespaces]]
> should be serialized on the object.

Hey Boris,

Cool thanks that's what I read the spec as.

> That said, this is a JS engine bug, not a Gecko XML bug.

Yes apologies I wasn't sure which NG to post E4x questions to - XML or JS.

Cheers,

N


0 new messages