Starting with FlexJS version 0.7.0, XML and E4X is supported. This includes XML literals and most E4X expressions. Some advanced filter expressions might not work, but simple ones should.

The primary thing to keep in mind when using XML in FlexJS is that the type must be declared. For the compiler to convert ActionScript XML types into regular javascript, it must know that it's dealing with XML and not some arbitrary object.

Some areas where this is particularly important:

  1. "for each"
  2. "." and ".." statements.
  3. E4X expressions.
  4. "delete" statements.

This applies to any area where the compiler must rewrite the code in Javascript as function calls.

To best handle this, xml types should always be declared as typed variables. Even casting is not always guaranteed to work.

Another way to handle some of these issues would be to use explicit function calls (such as xml.child("node") instead of xml.child), but using functio  calls is not always practical, so declaring types is the best practice.

This said, if you do encounter a case where XML, E4X or filter expressions are not handled correctly, please create a JIRA with a test case.

  • No labels