[haXe] Identity of two Xml nodes

Daniel Cassidy mail at danielcassidy.me.uk
Thu Jul 5 12:07:11 CEST 2007


Hi Nicolas, List,

I have observed the following problem with the haXe Xml class:

var element = Xml.createElement("foo");
var child = Xml.createElement("bar");
element.addChild(child);
element.firstChild() === child; // true on Neko, Flash 9, JS; false on Flash 8.

The problem is that the Flash 8 implementation wraps native XML nodes
on the fly, and it's therefore impossible to reliably test two XML
nodes for identity.

I suggest that a function like this be added to the Xml class:
public function is (x:Xml) :Bool; // returns true if this===x

Thanks,
Dan.



More information about the Haxe mailing list