e4x object missing inScopeNamespaces()

View: New views
3 Messages — Rating Filter:   Alert me  

e4x object missing inScopeNamespaces()

by "neil.stansbury () redbacksystems ! com" :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: e4x object missing inScopeNamespaces()

by Boris Zbarsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: e4x object missing inScopeNamespaces()

by "neil.stansbury () redbacksystems ! com" :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 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


_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml