The text.xml.encode function encodes an arbitrary type as XML. Each tagged field in the type is encoded. Tags are @(Xml.Attribute("attributeName")) and @(Xml.Element("tagName")). Types passed directly to encode must be annotated with an @(Xml.Element("...")) attribute. Child types must be annotated at their fields in the containing type. For array fields, their values are encoded sequentially. Nullable fields are omitted if they are null.