XML

The BizTalk Editor

The BizTalk Editor allows you to edit BizTalk documents and schemas. Using the BizTalk Editor, you can import existing document definitions, including DTDs, BizTalk schemas, electronic data interchange (EDI) specifications such as American National Standards Institute (ANSI) X12 and electronic data interchange for administration, commerce, and transport (EDIFACT), flat files, well-formed XML, structured document formats, and XML-based templates. You can also create new specifications from blank templates. A specification is a structured document that tells BizTalk Server 2000 how to format data. All specifications are stored as XML. Let's take a look at how the BizTalk Editor works.

If you have installed BizTalk Server 2000, click the Start button, point to Programs, Microsoft BizTalk Server 2000, and then choose BizTalk Editor to open the BizTalk Editor. We will work with the Northwind.biz document we created in Chapter 9 to see how to use the BizTalk Editor to edit this document. First take the following code in the Northwind.biz document and save it as Categories.xml (we have removed the customer element because the BizTalk Editor currently imports only one component at a time):

  <Schema name = "NorthwindSchema"
      xmlns = "urn:schemas-microsoft-com:xml-data"
      xmlns:dt = "urn:schemas-microsoft-com:datatypes">
      <ElementType name = "Categories"
          xmlns:Categories = "urn:northwindtraders.com.Categories"
          content="eltOnly" model="closed">
          <group order = "seq">
              <element type = "Categories.CategoryID"
                  minOccurs = "1" maxOccurs = "1" />
              <element type = "Categories.CategoryName"
                  minOccurs = "1" maxOccurs = "1" />
              <element type = "Categories.Description"
                  minOccurs = "0" maxOccurs = "1" />
              <element type = "Categories.Picture"
                  minOccurs = "0" maxOccurs = "1"/>
          </group>
      </ElementType>
      <ElementType name = "Categories.CategoryID"
          xmlns:Categories = "urn:northwindtraders.com.Categories"
          dt:type = "int">
          <description>
              Number automatically assigned to a new category
          </description>
      </ElementType>
      <ElementType name = "Categories.CategoryName"
          xmlns:Categories = "urn:northwindtraders.com.Categories"
          dt:type = "string">
          <description>Name of food category</description>
      </ElementType>
      <ElementType name = "Categories.Description"
          xmlns:Categories = "urn:northwindtraders.com.Categories"
          dt:type = "string"/>
      <ElementType name = "Categories.Picture"
          xmlns:Categories="urn:northwindtraders.com.Categories"
          dt:type = "bin.base64">
          <description>
              Picture representing the food category
          </description>
      </ElementType>
  </Schema>

To import a well-formed XML document, a DTD, or a BizTalk schema, from the Tools menu choose Import. The Select Import Module screen will appear as shown in Figure 16-1.

Figure 16-1. The Select Import Module screen.

Since we are working with a BizTalk schema, choose XML-Data Schema and then select the Categories.xml file. At this point, a dialog box will appear informing you that group elements are not supported; just click OK. The records and fields of the imported schema will appear in the BizTalk Editor specification tree, as shown in Figure 16-2.

Figure 16-2. Imported schema in BizTalk Editor.

As you can see, the BizTalk Editor has imported most of the information, such as the elements and their child elements and the values of these elements. However, it did not import the data types. You will need to add the data types. For the CategoryID element, click on the right column next to Data Type and a list box will appear. Select integer[int] from the drop-down list. Add the data types for the other elements.