The format element defines a conversion between some primitive or object type and the text representation used for that type. Any type with a format defined can be used with simple element (one with no child elements), text, or attribute values. During unmarshalling, the text content of the element or attribute is passed to the deserializer defined for that format, which returns a value of the appropriate type. During marshalling, the typed value is passed to the serializer for that format, which returns a text string used as the element content or attribute value.
This flexibility for conversion handling is also available without using a format element definition, by directly specifying the serializer and/or deserializer in a value definition. The advantage to using a format definition is that it can be easily reused. There are two ways of doing this. When a format element does not have a label attribute, it automatically becomes the default for values of the associated type. When a format element is defined with a label, that label can be used to reference it as needed.
The format element supports a pair of unique attributes along with one common attribute group, listed below.
format elements are subject to the restriction that labels must be unique, and unlabeled formats with the same type cannot be defined in the same context.