posted 8 years ago
In the area of schema structuring into components, the only immutable rule is that each schema document can handle one and only one targetNamespace for by its global scope schema elements (whereas some null namespace structure can appear in it through the local scope schema elements controlled by the schema's element/attributeFormDefault attribute). If there are more than one namespace involved, xs:import is unavoidable somewhere in one or another or all of the schema documents.
As to splitting the document of the same targetNamespace, it can in principle potentially be done for each and every global element. Hence, there would hardly be any rule on how and which global elements should be splitted out into an external schema to be included into some others. Of course, to facilitate reuse is a valid guiding principle but that would really push the "artificial integence" of code-generation a bit too hard... Hence, jaxb schema generation generates one schema document for each namespaceUri it encounters. It cannot acquire enough information to split a schema out into smaller ones and integrate them through the use of xs:include.
Codewise, suppose Class A reference Class B and Class C (where B and C do not reference to each other, say) all belonging to the same namespace. The best one can do is to make out JAXBContext object, with a SchemaOutputResolver attached to it, for Class A, Class B and Class C separately where A would generate a bigger schema document integrating into it what would have been generated by B and C. It wouldn't be able to generate something like two xs:include to include what B and C would have generated. If one want to see how the smaller schema documents would look like for B and C, they can still be generated in that regard.
The above is how I would summarize to my understanding the general picture of jaxb schema generation mechanics.