Just add some fixes.
If you want to check if a property exists, even if it is empty, you should definitely use hasOwnProperty:
var propertyExists:Boolean = node.hasOwnProperty('@hasCover');
Checking the length of the content is somehow dirty and will return false if the attribute value is empty. You might even get a runtime error, because you are trying to access a property (length) for a null object (hasCover) in case the attribute does not exist.
If you want to check if a property exists and the value is set, you should try both , starting with hasOwnProperty , so that the value test (possible runtime error) is ignored if the attribute does not exist:
var propertyExistsAndContainsValue:Boolean = (node.hasOwnProperty('@hasCover') && node.@hasCover.length ());
source share