Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

BizTalk 2010 Recipes : Document Schemas - Creating Flat File Schemas via the Wizard

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/26/2011 6:47:56 PM

1. Problem

You are receiving an order file in flat file format from one of your customers. You would like to use the Flat File Schema Wizard to expedite the creation of an XML schema.

2. Solution

To demonstrate how to use the Flat File Schema Wizard . To create the flat file schema using the Flat File Schema Wizard, follow these steps:

  1. Open a new BizTalk Server project.

  2. Right-click the project, and select Add => New Item.

  3. In the Add New Item dialog box, select the Flat File Schema Wizard template. Click Add. Figure 1 demonstrates this step.

    Figure 1. Creating a new flat file schema
  4. On the Welcome screen of the BizTalk Server Flat File Wizard page, click Next.

  5. On the Flat File Schema Information page (shown in Figure 2), specify the information that will be used as input to generate the specifics of the desired flat file schema:

    • Instance File: Use this to specify where your source instance file is located.

    • Record Name: Specify the Root node of the schema you want to create. For this example, enter CustomerSalesOrder.

    • Target Namespace: Specify the namespace of the schema you'd like to create.

    • Code Page: This identifies the encoding format of a file. In this instance, use the default, which is UTF-8 (65001).

    • Count Positions in Bytes: This specifies whether positions are calculated by bytes. If this box is not checked, positions will calculated by characters.

    Figure 2. Flat File Schema Information page
  6. Click Next.

  7. On the Select Document Data page, specify the data contents that will be used to generate the schema. The data contents are based on the instance file specified on the Flat File Schema Information page. Highlight the contents of the file that will be used to define the document data, as shown in Figure 3.

    Figure 3. Source Document Data page
  8. Click Next.

  9. Now define the record format. In this example, the record is delimited by a carriage return and a line feed, as shown by the record identifier ORDER2004-10-24. Select the By Delimiter Symbol radio button, as shown in Figure 4.

    Figure 4. Selecting the record format
  10. Click Next.

  11. Now, specify the properties of the record (as shown in Figure 5). This step will define the makeup of the record to represent CustomerSalesOrder:

    Figure 5. Specifying the properties of the delimited record
    1. Specify the child delimiter. Given that the record is defined by delimiter, select the child delimiter {CR}{LF}.

    2. Select the Record Has a Tag Identifier box. In this example, the tag identifier will be ORDER.

    NOTE

    ORDER is the identifier based on it being the text identifier that is specified in the source record. This text will be searched for to identify the continuation or creation of a new record. Not all text files will have a record tag identifier; in these cases, leave this box unchecked.

  12. Click Next.

  13. Now, specify the properties of the child elements for the record (as shown in Figure 6). This step will identify the makeup of the elements for CustomerSalesOrder. Using the grid on the Child Elements page, define the record's child elements. In this example, set the values shown in Table 1.

    Figure 6. Specifying the properties of the record's child elements
    Table 1. Child Element Properties
    Element NameElement TypeData Type
    dateField ElementDate
    customerHeaderRepeating Record 
     Ignore 
    itemsRecord 

    NOTE

    Observe that the customer ShipTo information is ignored because the record is the same structure as the customer SoldTo. Instead, the customer Header can be modeled using the Repeating Record element type.

  14. Click Next.

  15. On the Schema View page, the fundamental structure of the CustomerSalesOrder schema appears. Now, you'll define the individual characteristics of the child records of the schema. Figure 7 shows the page showing the schema structure.

    Figure 7. Schema view of the CustomerSalesOrder schema
  16. Select the customerHeader element. Click Next to continue.

  17. On the Select Document Data page, select the data that will be used to define the customerHeader record by ensuring the first line is selected, as shown in Figure 8.

    Figure 8. Document data—customer header
  18. Click Next.

  19. Now, you will select the record format for the customer header. In this example, select the By Relative Positions radio button, as shown in Figure 9.

    Figure 9. Record format—customer header
  20. Click Next.

  21. The wizard will give a visual representation of the record's element positions. Use this tool by selecting the starting position of each record element. You can do this by clicking the mouse at each element's starting point, as shown in Figure 10.

    Figure 10. Specifying the positional record
  22. Click Next.

  23. Next, you will specify the properties of the child elements for the customer header record. This step will identify the makeup of the elements for CustomerSalesOrder/customerHeader. These XML elements are derived from the positional representation of the record elements on the previous page. So, using the grid on the Child Elements page, define the record's child elements. In this example, set the values shown in Table 2.

    Table 2. Child Element Properties
    Element NameElement TypeData Type
    customerTypeField Elementstring
    fullNameField Elementstring
    streetField Elementstring
    cityField Elementstring
    stateField Elementstring
    postalField Elementstring

  24. Click Next.

  25. On the Schema View page, the CustomerSalesOrder schema appears with an updated customerHeader structure, as shown in Figure 11. Next, you'll define the characteristics of the items record, so click Next.

    Figure 11. Schema view of CustomerSalesOrder
  26. On the Select Document Data page, select the data that will be used to define the items record. Ensure the items data line is selected, as shown in Figure 12.

    Figure 12. Document data—items
  27. Click Next.

  28. Now you will select the record format for the items data. In this example, select the By Delimiter Symbol radio button.

  29. Click Next.

  30. Next, you will specify the properties of the items record (as shown in Figure 13). This step will define the makeup of the record to represent CustomerSalesOrder/items:

    1. Specify the child delimiter. Given that the record is defined by a comma delimiter, select the comma (,) child delimiter.

    2. Check the Record Has a Tag Identifier box. In this example, the tag identifier will be ITEMS.

    Figure 13. Properties of the delimited record—items
  31. Click Next.

  32. You will now specify the properties of the child elements for the items record (as shown in Figure 14). This step will identify the makeup of the elements for the CustomerSalesOrder/items that are derived from the delimiter specified on the previous page. Using the grid in the Child Elements page, define the items record's child elements. In this example, set the values shown in Table 3.

    Table 3. Child Element Properties—Items
    Element NameElement TypeData Type
    itemRepeating Record 
     Ignore 

    Figure 14. Specifying properties of the items record's child elements
  33. Click Next.

  34. On the Schema View page, the structure of the CustomerSalesOrder schema is updated. Now, you can define the individual characteristics of the itemsFigure 15 shows the page with the schema structure. record's child elements.

    Figure 15. Schema view of the CustomerSalesOrder schema
  35. Make sure the item element is selected. Click Next to continue.

  36. On the Select Document Data page, select the data that will be used to define the item record. Ensure the items line is selected, as shown in Figure 16.

    Figure 16. Document data—items data
  37. Click Next.

  38. Now, select the record format for the items data. This example will use delimited, so select the By Delimiter Symbol radio button, and click Next.

  39. Next, you will specify the properties of the items data elements. This step will define the makeup of the data elements to represent CustomerSalesOrder/items. You'll now specify the child delimiter: given that the record is defined by the pipe delimiter (|), select the child delimiter |, as shown in Figure 17.

    Figure 17. Properties of the delimited record—items data
  40. Click Next.

  41. Next, you will specify the properties of the child elements for the items record (as shown in Figure 18). This step will identify the makeup of the elements for the CustomerSalesOrder/items/item and are derived from the delimited specification. Using the grid on the Child Elements page, define the record's child elements. In this example, set the values as shown in Table 4.

    Figure 18. Specifying the properties of the record item's child elements
    Table 4. Child Element Properties
    Element NameElement TypeData Type
    productIdField elementstring
    productNameField elementstring
    quantityField elementint
    unitPriceField elementfloat
    descriptionField elementstring

  42. Click Next.

  43. This completes the creation of the schema, so click Finish to complete the schema. Figure 19 shows the finished product.

    Figure 19. The finished schema
  44. To test the schema, check that the Input Instance File in the properties is set to a valid flat file instance. Right-click the CustomerSalesOrder.xsd file in Solution Explorer, and select Validate. This will generate an XML version of the flat file, which is shown in Figure 20.

    Figure 20. XML version of the flat file, created by validating the schema

3. How It Works

In this recipe, we demonstrated how to use the Flat File Schema Wizard. To recap the scenario, you used the wizard to create a fairly complex illustration of a flat file to XML schema creation using different positional and delimited flat file references at the record, line, and field levels. The tool allows a developer to reverse engineer a schema based on a sample flat file instance.

Not demonstrated in this example but a common consideration when working with flat files is the usage of escape characters. You can accommodate escape characters when defining the properties at the record, line, or field level.

The Flat File Schema Wizard makes the process of defining schemas simpler, because the user sees the schema being modeled through the process and, in addition, is not exposed to the complexity of the schema syntax.

As helpful as the tool might be, it is still important to understand what the requirements are for the schema and how specifically the file will be implemented. Given this, you should spend some design time trying to understand exactly what the schema will do and how this relates to other processes (such as other interfaces and other trading partners).

Other -----------------
- BizTalk 2010 Recipes : Document Schemas - Creating Flat File Schemas
- SharePoint 2010 : Testing the Three-State Workflow
- SharePoint 2010 : Reviewing the Workflow-Related Settings in Central Administration and Site Settings
- SharePoint 2010 : Defining Workflows in the Business Environment
- Exchange Server 2010 : Setting Up Public Folders (part 5) - Create and Configure a Public Folder
- Exchange Server 2010 : Setting Up Public Folders (part 4) - Create and Configure a Dynamic Distribution Group
- Exchange Server 2010 : Setting Up Public Folders (part 3)
- Exchange Server 2010 : Setting Up Public Folders (part 2) - Mail-Enable Public Folder & Configuring Public Folder Limits
- Exchange Server 2010 : Setting Up Public Folders (part 1) - Creating Public Folders & Configuring Public Folder Permissions
- Windows Server 2008 R2 : Managing Computers with Domain Policies (part 7)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server