Fix the XML writer to better handle invalid keys
Changed the validator to run the constraints when the field is not required but a default value is specified.