OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]

[ Lists Home | Date Index | Thread Index ]
  • To: "Chizzolini Stefano" <chist@csb.it>,<xml-dev@lists.xml.org>
  • Subject: RE: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]
  • From: "Dare Obasanjo" <dareo@microsoft.com>
  • 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:chist@csb.it]
Sent: Sat 12/18/2004 1:20 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] [xsd] Guidelines [was: [xsd] Schema in multiple documents]



Thanks, Masaaki.

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
MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/html
/xmlschemacomplex.asp).

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? ;)

Regards,
Stefano

> -----Messaggio originale-----
> Da:   Masaaki KOGA [SMTP:koga@a-dos.com]
> Inviato:      venerd́ 17 dicembre 2004 3.33
> A:    Chizzolini Stefano
> Cc:   xml-dev@lists.xml.org
> 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'.
>
> http://www.kohsuke.org/xmlschema/XMLSchemaDOsAndDONTs.html
>
> That maybe help you.
>
> And also, there are many practical XSDs.
> As I know, it seems the best practice is as following sample.
>
> http://www.rosettanet.org/PIP7C7
> (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.
>
> Regards,
>
> Masaaki KOGA
>
>
> On Wed, 15 Dec 2004 12:50:06 +0100
> Chizzolini Stefano <chist@csb.it> wrote:
>
> > Hi all
> >
> > 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
> > 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
> 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.
> >
> > 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
> 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
> > C)!
> > - 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!
> >
> > 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
manager: <http://www.oasis-open.org/mlmanage/index.php>







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS