Lists Home |
Date Index |
I'm defining a schema (via XML Schema) stretched over multiple documents,
but I feel quite unsure about the best strategy to reference its definitions
each other across the file boundaries.
What I need is a clean method to enable the reuse of components.
As I know, there are mainly two constructs from the XSD namespace for this
- include element: same target namespace as the including document;
- import element: any target namespace.
(I chose the include element as it seems to fit my case).
My headache comes when I try to establish WHICH document references WHAT
For example (the target namespace is the same for all the documents):
- document A contains common types (it could be considered the main document
for the target namespace);
- document B contains derived types;
- document C contains other basic (non-derived) types;
- documents FF are future extensions of the target namespace.
Document A should be reused by B and FF.
- include A inside B and FF, whilst C inside A? This way all the common
components are centrally referenced by A, while any extension document (B or
FF) has just to care about referencing the main document (A). This should
improve the referential consistency and smooth expandability, but forces any
instance document to reference the location of a specific "leaf" schema
document (I say, B or FF) as the main document (A) isn't aware about any
extension document (it has just references to basic component documents like
- include A inside B and FF, whilst B and FF and C inside A? This way any
instance document could reference just the main document (A) and use all the
derived types at a time, but the references across the schema documents
would be multiplied and would cause circular references (is it legal? may it
affect the validator performance?). As another side effect, the main
document should be updated any time an extension document is created.
Which solution do you think that's better?
Is there another (better) approach?
Thanks for the tips!