Search code examples
xmlactionscript-3e4x

How do I compare attribute to a lower case value?


How do I create a filter where the attribute value is lowercase?

This works:

xmlItem = xml.*.(attribute("name")==propertyName);

But this is throwing an error:

xmlItem = xml.*.(attribute("name").toLowerCase()==propertyName);

Solution

  • It looks like I have to use toString() to get the String object and then I can use toLowerCase():

    var xmlList:XMLList = xml.*.(attribute("name").toString().toLowerCase()==lowerCasePropertyName);