Consider testReuseJabBindingFile1. This has a jaxb binding file with no schemaLocation at all. So we put in the wsdl pathname.
Well, the natural system id in XmlSchema is never just the wsdl file, its always got #typesN. At the time the code looks at the binding file, it has no idea which schema from the WSDL file is the right one. Apparently, xjc is happy to have N schemas all claiming to live at the same system ID as they call the 'key'. I'm having a difficult time imagining how it decides which one of several to look at when there are several with the same system ID, perhaps it disambigs with TNS? My next experiment I guess will be to trim the #types business off of the system ID before handing it to xjc. As for just continuing to pass DOM about, it's not so easy. The tooling code sometimes calls the schema builder, but sometimes assumes that a schema is already built, and so I have not figured how how the schema builder can decide to keep the DOMs around for the tooling.
