Can't change xml nodes attributes

Ok so I’ve done this with AS2 but for some reason it’s not working in AS3. I’m new to it so I might be overlooking something. I have an xml node and I’m trying to change the value of one of it’s attributes. This worked in AS2

node.attributes.foo = “bar”

but in AS3 this creates a childnode for the node and calls it attributes and then makes a node inside that called foo like this.

<node>
<attributes>
<foo>
bar
</foo>
</attributes>
</node>

So what am I doing wrong? I don’t really see any documentation on how to do this otherwise. Any suggestions?