Adds ability for element attributes to be output when converting to Hash

This ability was useful for me when the resulting object needed to be flattened - otherwise the element attributes are lost when converting to a Hash.