Include ability to retrieve the necessary module information when
exceptions are raised from within the gen_xml function for those modules
that implement using this function directly instead of calling dispatch.
Also to ensure that the exception itself won't raise an exception due to
not being able to detect the correct calling module, ensure a default
value noting it was not able to detect the module is always set first.
Provide a fallback when the code can explicitly specify the module as
the source component of the exception for cases where it may not be
possible to autodetect.
Change-Id: I3f72fe5f05a5e1f40a089e1f828dd295501bd9c7