Usability issue with empty forms: how to fix? (xml-malformed)

I want your opinion on how this usability issue can be fixed in the best manner. When a user submits a form to register to any transport (not only the Openfire-only transports) and forgets to enter one or more required field values, he will get an ugly xml-not-well-formed error. The problem is that the XMPP client can not see which fields are required. So which of these scenarios if possible, the best, or do you have a better solution?

  1. Some (part of a) XEP defines an identifier for required tags. E.g. <username required=‘yes’/>. The XMPP client then does not send the form when the user did not entered all required values and it will show a more userfriendy error message like “Please enter a username”.

  2. The transport sends back a more userfriendy error.