Reputation: 38706
I have three schemas: slideshow, problems, and widgets. The slideshow and problems schemas import widgets. However, the namespace of slideshow, problems and widgets are different. I've defined my imports like the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.mydomain.com/slideshow"
xmlns="http://www.mydomain.com/slideshow"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wd="http://www.mydomain.com/widgets"
elementFormDefault="qualified">
<xs:import namespace="http://www.mydomain.com/widgets" schemaLocation="./widgets-v1.0.xsd"/>
</xs:schema>
However, this requires I use fully qualified names for elements from the widgets schema (eg wd:someElement). I'd really like to import the definitions from widgets into the slideshow and problem namespace so you don't have to use wd:someElement to refer to someElement. As if they were defined directly in those respective schemas.
I've tried include, but that requires widgets be the same namespace of the importing document with problems and widgets being different so that option seems like it doesn't work.
How can I do this?
Upvotes: 1
Views: 892
Reputation: 21638
The only way to do it is to employ the reuse of XSD content through the so called chameleon pattern. This would allow you, in terms of XML namespaces, to "white-label" whatever components you need.
Upvotes: 1
Reputation: 163322
If you want the elements in the three schema documents to be in different namespaces, then you will have to use QNames to reference them.
Of course you could change the design so they don't use different namespaces, but you haven't suggested that's what you want to do.
Upvotes: 2