Monday, December 06, 2004

XSD pt 2

I've recently been struggling with yet another xsd issue - importing schemas.

I've found that when importing schemas, multiple imports of the same 'base' schema cause duplicate type declarations, which VS.NET prevents.

e.g.
1. Define a datatype "MyDT" in a schema called CommonSchema.xsd
2. Create a second schema, which imports CommonSchema, called SchemaA.xsd.
3. Create a new schema, SchemaB.xsd, which itself imports CommonSchema.xsd.
4. Try to import SchemaA.xsd into SchemaB.xsd. VS.NET will throw an exception:

"1. The simpleType 'http://xyz.com/schemas/CommonSchema:MyDT' has already been declared. An error occurred at ..."

This makes some sort of sense, but I think VS.NET should be able to resolve this issue?

Interestingly, if I do the same operation in XMLSpy, it can validate the schema without errors - which suggests that this import scenario is valid within an XSD, just not within BizTalk schemas?

Has anyone come across the same issue, and if so, did you manage to solve it? (I've tried playing with RootReferences, namespaces etc., with no luck.)

1 comment:

Riaan Hanekom said...

I've got the same problem,just in Biztalk.

Have you resolved this yet?

I'm also under the impression that Microsoft could have resolved this : Is it that difficult to realise that the duplicate definitions come from the same file and is therefore the same definition?