We're updating the issue view to help you get more done. 

Fix recognition of namespace in extension handlers

Description

This patch fixes an issue in the recognition of extension handlers. The old code assumed that the namespace for the given extension would always be handled by the xmlns attribute of the root element. However, you are not guarunteed that the namespace attribute will not be prefixed by some servers and clients. The more reliable way in to rely on the Actionscript XML API to get the namespace.

— C:/Documents and Settings/rn996/workspace/xiff_as3_flexlib_beta1/src/org/jivesoftware/xiff/data/XMPPStanza.as (revision 5480)
+++ C:/Documents and Settings/rn996/workspace/xiff_as3_flexlib_beta1/src/org/jivesoftware/xiff/data/XMPPStanza.as (working copy)
@@ -141,8 +141,12 @@
{
var nName:String = children[i].nodeName;
- var nNamespace:String = children[i].attributes.xmlns;
+ // Namespace handling should be done by using AS2's XML api.
+ // Assuming XML attribute names will break against servers that
+ // prefix namespaces in the generated XML.
+ var nNamespace:String = XMLNode(children[i]).namespaceURI;
+
nNamespace = exists( nNamespace ) ? nNamespace : CLIENT_NS;
if( nName == "error" ) {

Message was edited by: RyanNorris

Environment

None

Acceptance Test - Entry

None

Activity

Show:
Sean Voisen
May 8, 2007, 2:28 AM

Need to reinvestigate to use AS3's namespace handling.

alberto
November 14, 2008, 4:52 AM

I encountered the problem of namespaces with prefixes. I modified the deserialize function in the XMPPStanza class. The modification is assuming that there is only one namespace among all the namespaces representing an extension in a given XML node. It was successfully tested using FlexBuilder 3.0 (AS 3.0). See my modifications below:
.....
var nNamespace: String = children[i].attributes.xmlns;

//alberto acevedo 11/13//2008
//start adding
//Look for namespaces with prefixes having a registered extension class
for each (var attr: Object in children[i].attributes)
{
if (ExtensionClassREgistry.lookup(attr.toString()))
{
nNamespace = String(attr);
break;
}
}
// end adding

...
...
nNamespace = exists(nNamespace)?nNamespace: CLIENT_NS;

Thanks,

Alberto Acevedo

Juga Paazmaya
August 2, 2012, 10:04 PM

While XML migration, the namespace handling has been rewritten.

Fixed

Assignee

Juga Paazmaya

Reporter

Sean Voisen

Labels

None

Expected Effort

None

Ignite Forum URL

None

Components

Fix versions

Affects versions

Priority

Major
Configure