XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
mallee shwariSubject: Importing XSD that are interdependant
Author: mallee shwari
Date: 19 Jul 2005 02:40 AM
Dear All,

I am a newbie to XSD import concepts. I have two XSDs as listed out here. I would like to import Address.xsd in Mainschema.xsd where Address.xsd is in turn importing Mainschema.xsd. They are interdependant.

1) Mainschema.xsd

<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified"


<xsd:import namespace="http://mypage.com/MainSchema/SubSchema/Address"


2) Address.xsd

<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified"

xmlns:Main="http://www.mypage.com/MainSchema" >

<xsd:import namespace="http://www.mypage.com/MainSchema" schemaLocation="../../MainSchema.xsd">

Now, Mainschema imports Address and Address, inturn imports Mainschema. So when I try to validate Mainschema, it shows the

error " Complextype PersonName has been already declared". PersonName is a complextype defined in Mainschema. Since

mainschema is imported in Address, it is showing errors related to duplicate declaration. Excuse me for sending sample files

here instead of the original XSD files,for not letting out the confidentiality. I dont find any rules to be observed while

importing XSD except that the imported schema should have a different target namespace. My concrete question is whether can

we import schema B in schema A where schema B is in turn importing schema A? The XSDs are generated from proven tools

provided by the client and they are supposed to be valid. Please help me. Is what I am doing logically correct ? I am going

mad and searching for the solution for the past 2 days :)

Any help would be sincerely appreciated

Thank you

Kasimier BuchcikSubject: Importing XSD that are interdependant
Author: Kasimier Buchcik
Date: 23 Jul 2005 07:32 PM
Circular imports and includes are explicitely allowed by the spec.
So if your scenario fails, then the schema processor is buggy.

Which validator did you use? Have you tried one of the custom
validation engines? I guess Xerces should work fine with it.

Actually, as per spec, the processor should only take care of
component identity, regardless where the component is stored; so
even if they occur in different files, and have the same component
name + targetNamespace, but are of equal structure, the processor
should not report any error. But I learned that such a level of
component identity checks is rarely implemented - in fact I don't know
which processor is able to do so.

I recommend using the W3X XML Schema mailing list for
schema related questions:


Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

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