Description
Discovered when doing experiments trying to combine smaller schemas together into larger schemas.
We want to take a no-namespace schema, such as jpeg.dfdl.xsd (from DFDLSchemas), and include it into a schema that gives it a target namespace.
For example suppose we create jpeg-ns.dfdl.xsd which is supposed to have a target namespace and it includes jpeg.dfdl.xsd.
The symbols in jpeg.dfdl.xsd are supposed to take on the new namespace of the file they are included into.
And here is what isn't working: references within jpeg.dfdl.xsd to global elements/types/groups within that schema (which means they are referencing global elements with no namespace) are supposed to end up referencing those same elmeents, but in the new namespace into which the schema was included.
This doesn't happen. You get SDEs about there being no definition for "{}empty", that is, the reference is to empty is also supposed to "chameleon" to be a reference to the new global element in the new chameleon namespace.
Per: Definitive XML Schema, Walmsley, ISBN: 0-13-065567-8. Chapter 4 (Schema Composition) Section 4.4.1 (Include) Example 4-4, pages 67-68.
In detail, suppose you create jpeg-ns.dfdl.xsd like this:
<xs:schema targetNamespace="urn:jpeg" ...> <xs:include schemaLocation="jpeg.dfdl.xsd"/> </xs:schema>
That should be all that is required to define a namespace-qualified version of jpeg.
Now you define a combined schema which combines jpeg and other schemas together like this:
<xs:schema targetNamespace="urn:combined" xmlns:jpeg="urn:jpeg"...> <xs:import namespace="urn:jpeg" schemaLocation="jpeg-ns.dfdl.xsd"/> ... <xs:complexType name="combo"> <xs:choice> <xs:element ref="jpeg:JFIF"/> ... </xs:choice> </xs:complexType> </xs:schema>
That should work. It doesn't. There's a global type defined and referenced in jpeg.dfdl.xsd named "empty".
The SDE one gets is that "{}empty" is not found.
But the xs:include should be converting that reference from one referring to the original no-namespace declaration to a reference to the new chameleon namespaced insteance of that type.