Improved XmlFormat to replace empty values with null