Use targetNamespace when resolving global references without a namespace prefix or default namespace
When resolving global references (e.g. global element declaration, complex types, DFDL variables, DFDL formats), if the QName does not have a prefix then we currently use the default namespace (i.e. xmlns="...") when resolving the reference. And if the schema does not define a default namespace then we just assume NoNamespace.
This works fine except when a schema with a targetNamespace includes a schema with no targetNamespace and default namespace. In that case, resolving global references in the included schema must use the targetNamespace of the including schema because all the global components have been chameleoned into a different namespace.
To fix this, we now pass around targetNamespace to a number of places where resolving a global reference might be done (which is a lot of places), and use that targetNamespace when resolving a QName without a prefix and no default namespace.
Note that the logic to resolve defineFormat references already did something similar using its custom "adjustNamespace" logic. This is removed so all global references use the same logic when resolving references--no post-resolution adjustment is needed.
A number of functions were refactored a bit to make the logic and style more consistent, making it easier to see where logic differed. Some unused functions were discovered and removed.
DAFFODIL-2916