Both the XmlAttribute and XmlElement attributes take an optional Name property. If you specify a name in these attributes, the serializer will use the new name for the output xml attribute or element. Below is an example class with custom attribute/element names.
class User
{
[XmlAttribute("name")] string Name { get; set; }
[XmlIgnore] string Password { get; set; }
[XmlElement("domain")] string Domain { get; set; }
[XmlAttribute("dept")] string Department { get; set; }
[XmlElement("background")] string Background { get; set; }
}