Refactor attribute cleaning code out of the parser classes.