Similar to my last post on parsing a Date object, you can’t assign XML data directly to a Boolean object or the value will always end up being ‘true’. This is because the Boolean() constructor parses all non-null XML data as true.

Consider the following XML:

var response : XML =
    <response>
        <status valid="false">200</status>
    </response>;


To get the data in the ‘valid’ attribute and assign it to a Boolean object, you’d do the following in your code:

var validString : String = response.status.@valid;
var valid : Boolean = (validString == "true");


Note that this will only work if the validString is all lowercase, so you may want to call toLowerCase() on validString just to be safe.