Biztalk Development Series (12) Schema Design Group and order

Source: Internet
Author: User
Tags biztalk

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 ).

Biztalk Development Series (12) Schema Design Group and order

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.