Fix #1372 "XML Schema types is not set"

Also fixes handling of schemas with both:

- `xmlns="bar"`
- `xmlns:foo="bar"`

on `xs:schema`. The empty prefix could be used in such cases.
Refactor for clarity