Encapsulated XMLData and helper functions.
Added GetAttributeOptional