Possible Duplicate:
e4x / as3: How to access a node with a dash in its name.
I've set the namespace for my XML to use SMIL and I'm able to pull the src attribute of an element this way:
my.node.@src
which gets "this is some URL"
However, I have another attr called 'system-bitrate'. Because of the minus sign, I can't do @system-bitrate
So I attempted what I normally do which is my.node.attribute('system-bitrate')
which isn't working.
Oddly enough, not even my.node.attribute('src')
works. I suspect this is due to the namespace? So how to I get attributes out using ny.node.attribute
?
The only thing that works is my.node.attributes()[1]
. I know that's not the "right way" so I'm hoping someone can enlighten me!
FYI I'm working with SMIL files
** edit **
Here's the namespace required for the XML I'm using:
default xml namespace = new Namespace('http://www.w3.org/2001/SMIL20/Language');
And an example of the XML I'm working with:
<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
<head>
<meta name="title" content="Live"/>
</head>
<body>
<switch>
<video src="myStreamName" system-bitrate="200000"/>
</switch>
</body>
</smil>
** code sample for DennisJaaman **
default xml namespace = new Namespace('http://www.w3.org/2001/SMIL20/Language');
var xml:XML = XML(event.target.data);
for each(var o:XML in xml.body['switch'].video) {
if(!hs) hs = o;
else {
trace(o.attributes()[1]); // works
trace(o.@url); // doesn't work either (makes me wonder about NS issues
trace(o['@system-bitrate']); // doesn't work
trace(o.attribute('@system-bitrate') // doesn't work
// etc etc, I just left a few in here
}
}