Here is some code of an XSD that is VALID in XML Spy but chokes in Biztalk on the referenced elements using a period or hyphen. Can anyone tell me if I am doing something wrong, or confirm this is a bug or a “feature?” Does anyone have a workaround? I have googled and searched high and low for anomolies in XSD/XML validation in .NET (and BizTalk) and have not seen anything (anyone with similar question or problem.)
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2012 rel. 2 (x64) (http://www.altova.com) by ZiggyDude (PA DPW-BIS) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="DotNetRestrictions">
<xs:complexType>
<xs:choice>
<xs:element name="Valid">
<xs:complexType>
<xs:sequence>
<xs:element name="Embedded-Hyphen"/>
<xs:element name="Embedded.Period"/>
<xs:element name="Embedded_Underscore"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Invalid">
<xs:complexType>
<xs:sequence>
<xs:element ref="Embedded-Hyphen"/>
<xs:element ref="Embedded.Period"/>
<xs:element ref="Embedded_Underscore"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="Embedded.Period"/>
<xs:element name="Embedded-Hyphen"/>
<xs:element name="Embedded_Underscore"/>
</xs:schema>
Notice the embedded underscores do NOT fail in .NET. Have gotten this to work by changing all periods and hyphens to underscores, but the sending agency will NOT provide the XML or XSD in an “underscore” format. The files go out to too many places with periods and hyphens. We either need to 1) configure this right so it works if possible, 2) fix BizTalk and .NET (heh.heh.heh) or 3) transform these XML documents on the fly to replace the periods and hyphens prior to processing.
Thoughts? and please confirm/dispute my theory that BizTalk/.NET chokes on these chars when elements are called as a reference.
TIA!
If the symptom of BizTalk “choking” is that you’re getting an error along these lines:
Then you can fix that by selecting the problematic nodes in the BizTalk schema editor and modifying their Rootnode TypeName property. Swap out the periods or hyphens for underscores – this only impacts the .NET type that gets generated, not the XML representation – and see if that solves your problem.