I'm trying to solve an Actionscript problem using E4X. I have an XML like this one:
<root>
<person firstname="john" lastname="doe" age="21" />
<person firstname="jayne" lastname="doe" age="35" />
<person firstname="john" lastname="miller" age="42" />
</root>
I want to have just one function search() that takes three parameters (firstname, lastname, age) and return an XMLList. So the result could look like this:
var result:XMLList = xml..person.(@firstname == firstName && @lastname == lastName && @age == age );
But I don't want to use all three parameters all the time. I would like to have a function that uses a 'wilcard' if the parameter is NULL. So if the wildcard would be "*" the function could look like:
searchPerson( firstName:String ="*", lastName:String = "*" , age:String = "*") {...}
so that I would only pass 'John' for the firstName I'd get the first and the third node in return.
How to do so?