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

Re: Re: Multiple xsd:imports on the same namespace

multiple xsd
Hi David,

> We have been asked to work with some schemas where the definition of
> a namespace is split between several schema documents, each defining
> a subset of the namespace. An example of what I mean is:
>  schemaA.xsd  defines namespaceA, and imports both schemaB.xsd and
>  schemaC.xsd into namespaceB. It then defines an element of each of the
>  types defined in schemas B and C, in namespaceB.
> What do people here think? Can anyone suggest a way of validating
> documents against these schemas?

The general arrangement that you should aim for when using W3C XML
Schema is for each namespace to be defined through a single schema
document and its includes -- i.e. have a single entry point for the
schema information about a particular namespace.

In your case, you could create a single entry point by having a fourth
schema document (schemaD.xsd) which includes both schemaB and schemaC:

<xsd:schema targetNamespace='http://www.example.com/namespaceB'

<xsd:include schemaLocation="schemaB.xsd" />
<xsd:include schemaLocation="schemaC.xsd" />

Then, rather than importing both schemaB and schemaC into schemaA,
just import schemaD instead:

<xsd:schema elementFormDefault='qualified'

  <xsd:import namespace='http://www.example.com/namespaceB'
              schemaLocation='schemaD.xsd' />

  <xsd:element name='Top'>
        <xsd:element name='B' type='nsB:TypeB' />
        <xsd:element name='C' type='nsB:TypeC' />


and things should work fine.



Jeni Tennison


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.
First Name
Last Name
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.