[xsd-users] 'conflicting type' problem while compiling msml schema

Boris Kolpackov boris at codesynthesis.com
Wed Nov 14 09:57:17 EST 2007


Hi Seungmin,

[I am resending this email since the original one had an invalid
address for the xsd-users mailing list. Please reply to this post.]

Seungmin We <wesm at filewood.snu.ac.kr> writes:

> I think it suffers from naming conflict. Actually the schemas has name
> conflicted elements but the namespaces are different. Why cannot XSD
> distinguish them?

The conflicting names are actually all in the same (XML Schema) namespace.
The problem, the so-called unstable name conflict, is quite tricky and
this is the first real-world schema that I see exhibiting it. In a
nutshell, XSD tries to automatically name anonymous types and resolve
conflicts. It normally does a pretty good job, but there is one case
where it is impossible to resolve a conflict automatically. A simple
example of this situation is when, say both a.xsd and b.xsd have
anonymous types that XSD would name 'foo'. A third schema, d.xsd,
includes both a.xsd and b.xsd and thus triggers a name conflict.
The problem is that this conflict only exists when compiling schema
d.xsd and will go unnoticed when you translate a.xsd and b.xsd. This
is why it is called unstable conflict.

XSD allows you to resolve this by providing a custom name mapping
expression via the --anonymous-regex option (see the XSD Compiler
Command Line Manual for more information). I was able to compile
your schemas by using the following regex:

--anonymous-regex "#.*  (.+)/(.+)#$1_$2#"

(Use ' instead of " on Linux/UNIX.)

I've also added the --generate-polymorphic option since your schemas
use substitution groups.

There is unfortunately another problem: the grammar-code.xsd defines
a enumeration with one of the values being "NULL". By omission, the
XSD compiler does not have NULL in its reserved names table and as
a result the generated code does not compile. This problem will be
fixed in XSD 3.1.0. For the meantime, I can build you a pre-release
binary so you can compile your schemas. If you would like that, then
let me know which OS you are using.

Boris




More information about the xsd-users mailing list