I have several XSDs which all use simpleType/complexType in GlobalTypes XSD. I tried to create a XML Schema Collection called GlobalTypes and created other XML Schema Collections using xs:import to import GlobalTypes but I always get error message - Reference to an undefined name 'XXX' within namespace 'XXX'. But if I copied GlobalTyps XSD into the XSD, I can create the XML Schema Collection.
I wonder if there is a way to refer simpleType/complexType defined in the GlobalTypes XML Schema Collections, otherwise I have to alter all XML Schema Collections if the GlobalTypes changed.
- Edited by wirelessoracle Thursday, December 15, 2011 3:56 PM
I think this is possible using xsd:import, assuming you have your XML SCHEMA COLLECTIONs stored as .xsd files, and create a routine to import them. SQL Server ( as at 2008 R2 ) does not support xsd:include.
See this link which does something similar:
It’s impossible to be sure without some kind of repro. This particular error message can be thrown for several different reasons.
A few of the more likely possibilities:
- It could be that the imported XSD contains an element at the top level that has both a name attribute and a ref. This is not legal.
- It could be complaining about a bad location in the schemaLocation attribute. We had problems with that in older versions of MSXML. I don’t see in the post which version you are using. Is this .Net or Native
- Import will fail if you try to derive by restriction in the second schema, using a base type defined in the first schema
Hope this helps
Terrell An -MSFT