A random collection of epiphanies, thoughts and problem solutions pertaining to .NET and BizTalk.

Tuesday, October 12, 2004

BizTalk: Type "http://www.w3.org/2001/XMLSchema:char" is not declared or not a simple type

If you use the datatype char(1) in the stored procedure, it will bomb when you try to generate XML schema in the "add SQL adapter wizard".


It turns out to be a BizTalk bug. You can still use char(1) and it will just work fine after applying the following fix. By default, the schema returned by SQL XML is XDR (XML data Reduced). You can observe this from the Query Analyzer. This reduced schema is not used by BizTalk; BizTalk uses the xsd. BizTalk relies on the XDRToXSD.xslt to transfrom the xdr generated by SQL Server to the desired xsd format. There's a problem in the XDRToXSD.xslt (this file locates in "C:\Program Files\Microsoft BizTalk Server 2004\"). To fix this problem change the following line:



<xsl:template match="@dt:type[.='char']" mode="convert-datatype">xs:char</xsl:template>
to:
<xsl:template match="@dt:type[.='char']" mode="convert-datatype">xs:string</xsl:template>


Thus, char(1) or char will be mapped to a xs:string. Actually, the default http://www.w3.org/2001/XMLSchema namespace has no xs:char build-in type. If you look at the following picture of the build in XMLSchema type hierachy you will find there's no xs:char.





For details about the XMLSchema build in data type click here.

No comments:

Followers