Lists Home |
Date Index |
- To: "Chizzolini Stefano" <firstname.lastname@example.org>,<email@example.com>
- Subject: RE: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]
- From: "Dare Obasanjo" <firstname.lastname@example.org>
- Date: Mon, 20 Dec 2004 07:46:14 -0800
- Thread-index: AcTk4huRxDMRMUKARkS8nhQJZAxq1QBx8483
- Thread-topic: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]
If you plan to use the same target namespace for all documents then I'd suggest that you have a single schema document which references all the other schema documents and use that for validation. Since all the schema documents use the same target namespace they logically are a single schema which just happens to be broken up physically across multiple files. In the scenario below I'd either use C or FF as the main document which includes all the others or create a new schema document whose purpose is too include all the others.
PS: Current versions of the XML schema validator in the .NET Framework has problems with diamond (A references B & C which both reference D) and circular imports which you should take note off if you will be validating documents on that platform.
PITHY WORDS OF WISDOM
Eat right, Exercise, Die anyway.
From: Chizzolini Stefano [mailto:email@example.com]
Sent: Sat 12/18/2004 1:20 AM
Subject: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]
Yeah, I read Kohsuke Kawaguchi's famous article on xml.com
(http://www.xml.com/pub/a/2001/06/06/schemasimple.html) about one year ago,
but I do not agree with several considerations of his own: my opinion
adheres to the counterpoint proposed by Dare Obasanjo
(http://www.xml.com/pub/a/2002/11/20/schemas.html) on xml.com and then on
Each mind sits upon its favourite niche and fits its environment so much as
possible! I say: as Mr Kawaguchi is the guru of RELAX NG while Mr Obasanjo
is a first-class employee at Microsoft (which massively supported the W3C
XML Schema WG), what do you imagine would be their respective opinions? ;)
> -----Messaggio originale-----
> Da: Masaaki KOGA [SMTP:firstname.lastname@example.org]
> Inviato: venerd́ 17 dicembre 2004 3.33
> A: Chizzolini Stefano
> Cc: email@example.com
> Oggetto: Re: [xml-dev] [xsd] Schema in multiple documents
> Hello Chizzolini,
> I'm trying to use XML Schema(XSD) too.
> There are many ways to define a schema with XSD.
> the following URL is the article about 'how to avoid the pitfalls'.
> That maybe help you.
> And also, there are many practical XSDs.
> As I know, it seems the best practice is as following sample.
> (download zip file, then extract
> and find root xsd file in 'XML/Interchange' directory)
> That is the standarized xml based message schema about
> notifing of Semiconductor Test Data. That design is 'Modular based'.
> I think that is a good sample for designing XSD.
> Masaaki KOGA
> On Wed, 15 Dec 2004 12:50:06 +0100
> Chizzolini Stefano <firstname.lastname@example.org> wrote:
> > Hi all
> > I'm defining a schema (via XML Schema) stretched over multiple
> > but I feel quite unsure about the best strategy to reference its
> > 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
> > purpose:
> > - 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
> > ELSE.
> > For example (the target namespace is the same for all the documents):
> > - document A contains common types (it could be considered the main
> > 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.
> > Should I:
> > - 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
> > improve the referential consistency and smooth expandability, but forces
> > 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
> > C)!
> > - include A inside B and FF, whilst B and FF and C inside A? This way
> > instance document could reference just the main document (A) and use all
> > 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!
> > Stefano
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription