Using XmlSerializer to create an element with attributes and a value but no sub-element
I find the answer here: Xmlserializer – Control Element-Attribute Pairing (revised). Here is how to do it: mark the value property with the [XmlText] attribute. public class Quantity { // your attributes [XmlAttribute] public string foo; [XmlAttribute] public string bar; // and the element value (without a child element) [XmlText] public int qty; }