0

I have a XML node with a - (minus) character in it. How can I access this in ActionScript E4X symtax without the compiler recognising the character as a minus operator?

E.g.

XML

<page>
     <about-page>yo</about-page>
</page>

ActionScript

this.contentXML..page.about-page.text()

Thanks, Ross

Ross
  • 14,266
  • 12
  • 60
  • 91

2 Answers2

3

You should be able to use the square bracket notation for accessing the property:

this.contentXML.page['about-page'].text()

Both the dot and square bracket notation do essentially the same thing, that is looking up a property. The only difference here is that the dot notation is limited by the syntax of the language.

Ivo Wetzel
  • 46,459
  • 16
  • 98
  • 112
2

You can also use the child notation as well.

simonrichardson
  • 1,049
  • 8
  • 14