Santiago is right that the test case is semantically equivalent to the schema
that has two <xsd:import>s to the same namespace URI.
The real issue here is that the JAXP RI doesn't meet the user expectation with
this kind of <import>ing two schemas of the same namespace URI. Whereas the
expectation of people is for both schemas to be read, the JAXP RI only reads the
first one and silently skips the second one.
This behavior has been a source of confusion for many users in JAXB, too. The
failure mode is often something like "no such element declaration tns:second",
and people scratch their heads because it's clearly imported, as far as they can
tell (and when they try other tools the schema works just fine.)
Yes, we are aware that this behavior is allowed by the schema spec. But if
that's the only criteria, the same schema spec allows you to ignore every
<include> and <import> altogether, which is clearly unusable. So we need to
design the behavior by factors beyond the schema spec compliance.
I do realize this part of the JAXP RI is a real hair ball inherited from Xerces,
so the fix might not be as easy as changing a few lines here and there, but I
really think this behavior needs to be fixed.