I've got an XML response from another system, but no XSD, so I used the Create Schema option to generate one.
I then added the XSD to my BizTalk 2006 R2 project and set its "Input Instance Filename" property to the original XML message.
Tried the "Validate Instance" option and it FAILS ???, with a couple of errors like so ...
error BEC2004: The xsi:type attribute value 'http://www.w3.org/2001/XMLSchema:int' is not valid for the element 'http://www.aniteps.com/xml/schemas/awm/images4:NumberOfErrors', either because it is not a type validly derived from the type in the schema, or because it has xsi:type derivation blocked.
How the heck can the XML fail that was used to generate the XSD ?
The XML example I have is ...
<?xml version="1.0" encoding="utf-8"?>
<ImportIndexDocumentResponse
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.aniteps.com/xml/schemas/awm/images4">
<HasErrors>false</HasErrors>
<NumberOfErrors xsi:type="xsd:int">0</NumberOfErrors>
<ErrorDescription xsi:type="xsd:string">No exception ocurred.</ErrorDescription>
<ErrorNumber xsi:type="xsd:int">0</ErrorNumber>
<FailedItems>
<Item>
<OriginalDataString xsi:type="xsd:string" />
<ErrorDescription xsi:type="xsd:string" />
</Item>
</FailedItems>
<UniqueDocumentReferences>
<UniqueDocumentReference>FA40FE</UniqueDocumentReference>
<UniqueDocumentReference>U55922</UniqueDocumentReference>
</UniqueDocumentReferences>
</ImportIndexDocumentResponse>
And BizTalk / Visual Studio 2005 generates ...
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.aniteps.com/xml/schemas/awm/images4">
<xs:element name="ImportIndexDocumentResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="HasErrors" type="xs:boolean" />
<xs:element name="NumberOfErrors" type="xs:unsignedByte" />
<xs:element name="ErrorDescription" type="xs:string" />
<xs:element name="ErrorNumber" type="xs:unsignedByte" />
<xs:element name="FailedItems">
<xs:complexType>
<xs:sequence>
<xs:element name="Item">
<xs:complexType>
<xs:sequence>
<xs:element name="OriginalDataString" />
<xs:element name="ErrorDescription" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="UniqueDocumentReferences">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="UniqueDocumentReference" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xsd:schema>