Was passing the name of the element instead of the element object when processing attributes.