FlexJS has a Qname class.  Looks like it is mostly used in XML.  It has a
toString() that adds a "::" between the uri and localname.  Is toString()
being used anywhere?

I want to change Qname.toString() to produce a valid JS identifier.  Then
I can use Qname outside of XML.  If mx_internal which is a namespace used
in a qname has the uri of "http://www.a.com/foo/bar"; is used in
Qname(mx_internal, "baz"), you currently get a toString() of
"http://www.a.com/foo/bar::baz";.  I believe that ':' and "/" and '.' are
not valid in JS identifiers, so I would just replace them all with "_"
(yes, I know I could URIEncode them, but it makes it less readable) so the
result would be "http___www_a_com_foo_bar_baz".
This would allow us to support

mx_internal function baz()

Which would then cross compile to:

someClass.prototype.http___www_a_com_foo_bar_baz = function()

And access like

Var baz:Qname = Qname(mx_internal, "baz");
someClass[baz] would then work.


Reply via email to