Wednesday, December 1, 2010

Caveat in using xsd.exe

Here is a trap that many can fall into when using xsd.exe:
1) If your xsd schema file uses <xsd:import> to add multiple schemas from different target namespace into the document, xsd ignores the schemaLocation attribute value.

In this case, you need to specify those imported xsd files on the command line.

2) If the document uses <xsd:include>, xsd uses the schemaLocation attribute value.

While it is great to use the latest and greatest but in many situation, particularly when you are given an XSD authored in other platform, SvcUtil.exe /dcOnly will frequently unable to handle XSD Schema syntax that XSD.exe can handle.

In that situation, alternately you can use the /importXmlTypes (/ixt) and ended up with types that implements IExtensibleDataObject, something that only existing in Microsoft world and may even impact on interoperability, certainly a J2EE Web Service does not have this.

No comments:

Post a Comment