— Forest and the Trees

XML Attributes to Object Properties

Now I can copy and paste this code instead of having to remember a.name().toString();

Anyway – this takes
var x : XML =
<node name=’Doug’ hadAGoodTimeSleddingOnSunday = ‘true’/>
to
o.name = “Doug”;
o.hadAGoodTimeSleddingOnSunday = “true” //yup you’d want to type that as a Boolean.

var o : Object = {};
var atts : XMLList = x.attributes();
for each (var a : XML in atts) {
var propName : String = a.name().toString();
o[propName] = a.toXMLString();
}

0 comments
Submit comment

247 Wildlife Control