0

Flex has an issue with hyphens in xml. I need to generate an xml object with hyphens in the attribute for a Google Checkout implementation.

I can get away with:

var xml:XML = <item-description/>;

and

var xml:XML = <item-description the-name="foo"/>;

but what I need to do is set the value of an attribute like this:

var timestamp:String = methodToGetMyTimestampString();

var xml:XML = <item-desc/>;
xml@start-date = timestamp;

but I can't do that. Since flex doesn't like the hyphens, I don't know how to get or set attributes with hyphens in the name.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
JLeonard
  • 8,520
  • 7
  • 36
  • 36

1 Answers1

1

Have you tried this:

xml.attribute("start-date") = timestamp;

or

xml.@["start-date"] = timestamp;
Christophe Herreman
  • 15,895
  • 9
  • 58
  • 86