[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: [xsd] Guidelines [was: [xsd] Schema in multiple documents]

  • To: "Chizzolini Stefano" <chist@c...>,<xml-dev@l...>
  • Subject: RE: [xsd] Guidelines [was: [xsd] Schema in multiple documents]
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Mon, 20 Dec 2004 07:46:14 -0800
  • Thread-index: AcTk4huRxDMRMUKARkS8nhQJZAxq1QBx8483
  • Thread-topic: [xsd] Guidelines [was: [xsd] Schema in multiple documents]

xsd circular reference
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@c...]
Sent: Sat 12/18/2004 1:20 AM
To: xml-dev@l...
Subject:  [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...]
> Inviato:      venerdì 17 dicembre 2004 3.33
> A:    Chizzolini Stefano
> Cc:   xml-dev@l...
> Oggetto:      Re:  [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@c...> 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>




PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.