[Serializer] Add xml_format_output context option. Close #12517.