For more information, see the BizTalk hands-on experiment series directory.
BizTalk Development Series
When developing a BizTalk project, the message format of the exchange between systems will be agreed first, Because BizTalk only uses XML documents. Therefore, the message format is XML Schema (XML Schema is used to describe the structure of the XML document ). Although BizTalk provides the XML message verification function. However, the BizTalk Schema designer often does not care much about the purpose of the Group when designing the Schema. Today, let's take a look at its role and hope it will be helpful for designing a flexible Schema.
First, let's take a look at the concept of Group. In W3C definition, Group is used to define the element Group used in the definition of complex types. Of course, the Schema defined by BizTalk complies with W3C specifications. however, the concept of Group is slightly different from that defined by W3C: Except for the Attriubte Group (element Group), the Group designed through BizTalk Schema does not actually create a Group, that is, the Group Name is not displayed in the Schema file. Instead, a complex type is defined through the corresponding Order indicator. The Group mentioned below is defined by the BizTalk Schema designer.
The following types of groups can be obtained from the Schema designer:
1.SequenceSpecifies that child elements must appear in a specific order.
2.ChoiceThe indicator specifies that a child element may appear or another child element may appear (which can be understood as a single choice)
3.AllSub-elements can appear in any order, and each sub-element can appear zero or once.
4.AttriubteAttribute Group
Group example
Open Visual Studio to create a BizTalk project and create a Schema file. On the Schema file, right-click the attribute and enter the path of the same file in the input/output attribute. In the next test, you can directly right-click Schema and select "generate instance" and "verify instance" to test the effect.
Sequence Group
Create a Record node named SequenceRecord on the Root node. Create a Sequence Group on the node. Create three elements under the Group ). As shown in
Generate a Schema XML instance. Open the source code to get the following XML content.
<Ns0: Root xmlns: ns0 = "http: // schemasample. schema1"/>
<SequenceRecord>
<First> First_0 </First>
<Second> Second_0 </Second>
<Third> Third_0 </Third>
</SequenceRecord>
</Ns0: Root>
To verify the Schema instance, you can view the successfully verified message in the output window. Change the node location. Save the file before moving the Third node to the First node. Verify the Schema instance again. The following message is displayed in the output window:
E: \ Projects \ SchemaSample \ Msgs \ Schema1.xml: error BEC2004: The element 'sequencerecord 'has invalid child element 'third'. List of possible elements expected: 'first '.
Choice Group
Create a Record node named ChoiceRecord on the Root node. Create a Choice Group under the node. Create two elements under the Group ). As shown in
Generate an XML Schema instance. Open the source code to get the following XML content (excerpt)
<ChoiceRecord>
<Female> Female_0 </Female>
</ChoiceRecord>
To verify the Schema instance, you can view the successfully verified message in the output window. Add the following content to the ChoiceRecord node:
<Male> Male_0 </Male>
Save the file and verify the Schema instance again. In the output window, get the following content:
E: \ Projects \ SchemaSample \ Msgs \ Schema1.xml: error BEC2004: The element 'choicerecord 'has invalid child element 'male '.
In this case, the Female node can be removed and verified again. In the output window, you can also see the message that the verification is successful.
Attriubte Group
Create a Record node in the Root node named AttributeGroup. Create Attribute Group under this node. Create two attributes under Group ). As shown in
The designer only allows the creation of Attribute fields under Attribute Group.
Generate the XML instance of the Schema and obtain the following content (excerpt)
<AttributeRecord Attribute_1 = "Attribute_1_0" Attribute_2 = "Attribute_2_1"/>
Summary
The above Sample shows the categories and functions of the BizTalk Group. Sequence, Choice, and All are the Order indicators defined in W3C (Order indicators are used to define the Order of elements), but somehow ALl groups are gray. Therefore, this instance does not test the All type. In addition, the Group Order Type attribute of the Record can be directly defined to specify the sorting category of the entire Record (as shown in ).