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 Mapping - Mapping Any Element Nodes

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/27/2011 8:40:02 PM

1. Problem

You need to create a mapping between two schemas containing elements and attributes that are unknown when building the map, and you must include the unknown schema structures in your mapping.

2. Solution

You can include unknown schema structures in a map by using the <Any> element.

  1. Build a source message schema containing an <Any> element. This can be done by right-clicking the record in the schema and selecting Insert Schema Node => Any Element, as shown in Figure 1.

    Figure 1. Creating a source message with an Any element
  2. Build a destination schema containing an <Any> element, as shown in Figure 2.

    Figure 2. Creating a destination message
  3. Add a new map to the solution. Set the source and target schemas appropriately.

  4. Click the Toolbox, and then click the Advanced Functoids tab. Drag a Mass Copy functoid onto the map surface. Connect the Address element from the source message to the Mass Copy functoid, and connect the Mass Copy functoid to the Address field of the destination message.

  5. Create other desired mapping links normally, as shown in Figure 3.

    Figure 3. Configuring the Mass Copy functoid

3. How It Works

An <Any> element in a schema designates a specific location in the schema where new elements or attributes can be added. When BizTalk uses the schema to process a message containing unknown elements or attributes in the designated location, the schema will still consider the message valid. If this source message is mapped into a different schema that also has a location designated for extensibility with an <Any> element, then the information must be copied to that location with the Mass Copy functoid.

NOTE

By default, BizTalk will examine only the namespace and root node name of a message to identify the schema, and will not detect extra elements in the message body. To perform a deep validation of a message format, create a receive pipeline with the XML disassembler, specify the schema to validate messages against, and set Validate Document Structure to true. 

The contents of an <Any> element cannot be mapped with most of the default BizTalk functoids. Other functoids require establishing an explicit link from a source field, and that is not possible if the source field is not known at design time. The Mass Copy functoid can be linked only directly to an ancestor of the <Any> element, which may not give the granularity of control desired. Consider using an XSLT script with the Scripting functoid to achieve finer control. For example, if you know some element will be present at runtime but cannot predict the element name of its parent, an XSLT script can still perform the mapping.

Note that you can override the mapping of the mass copy on a line by line basis. For instance, if the Zip field needs to be mapped differently, simply add the appropriate functoid(s) and map it; this will override whatever the Mass Copy functoid has created (see Figure 4).

Figure 4. Overriding AddrLine2 within a Mass Copy functoid

Sometimes, the BizTalk development environment has difficulty validating schemas containing <Any> elements. It can incorrectly determine that elements and attributes appearing in the location designated by the schema should not be there, causing validation for the schema to fail. This complicates schema development because the developer must deploy the schema with a pipeline capable of validating the document structure to check if the schema is correct according to a sample source message. To avoid this deployment effort while developing the schema, wait to add <Any> elements until the rest of the schema is developed and verify that those other elements are defined correctly. Then, when adding the <Any> elements to the schema, there will be a baseline of what is working correctly.

The Mass Copy functoid allows source records and containing elements and attributes to be copied and mapped across to the destination schema. This in turn, allows large structures to be mapped quickly in design time, without the need of performing 1:1 detailed mapping on all subsequent schema nodes. The Mass Copy functoid performs the recursive copying by applying a wildcard (/*) XSLT template match on source to destination XML elements. This is of particular benefit when the destination is defined as an <xs:any> type.

When mapping from source to destination, only the structure under the destination parent XML record will be copied. This often results in having to re-create the parent record element to allow all subsequent children nodes to be mapped to the destination schema. For example, consider the following two schemas, CustomerCustomers: and

<Customer>
<Name> </Name>
<AccountID> </AccountId>
<DOB> </DOB>
</Customer>


<Customers>
<Customer>
<Name> </Name>
<AccountID> </AccountId>
<DOB> </DOB>
</Customer>
</Customers>

In this instance, the <Customers> record cannot be mapped to the <Customer> record on the destination schema. A containing element <Customer> will need to be defined on the destination schema to enable the correct operation of the Mass Copy functoid mapping.

When mapping source to destination elements, always be cautious of underlying XSD schema rules, such as cardinality, order, and data types. For example, the Mass Copy functoid will "blindly" copy all child elements specified to the destination schema. It will not copy elements out of order or check for required values in the destination schema.

Changes to the source and destination schema may result in the need to update your impacted maps leveraging the Mass Copy functoid. This, in turn, will mandate a recompile and deployment of your BizTalk solution.

Using the Mass Copy functoid within the BizTalk Mapper is one of a variety of ways to recursively copy elements. The following are three key approaches to recursively copy XML structures:

Mass Copy functoid: Creates a wildcard XSLT template match to recursively copy elements. This approach may provide a performance benefit, as each source and destination element does not require a 1:1: XSLT template match. This, in turn, requires fewer XSLT code instructions to be interpreted and executed at runtime.

Recursive mapping: This is achieved by holding down the Shift key and mapping from a source to destination record element. This is a usability design feature that enables a developer to perform recursive mapping via one keystroke. This approach implements 1:1 XSLT template matches on all source and destination elements.

Straight-through mapping: This approach is to manually link all source and associated destination elements within the BizTalk Mapper tool. This method does 1:1 template matches on all source and destination elements.
Other -----------------
- BizTalk 2010 Recipes : Document Mapping - Adding and Configuring Mapping Constants
- Windows Server 2003 : Troubleshooting Server Services (part 2) - Using Service Recovery Options to Diagnose and Resolve Service-Related Issues
- Windows Server 2003 : Troubleshooting Server Services (part 1) - Diagnosing and Resolving Issues Related to Service Dependency
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 4) - Configuring Local Security Policies with the SecEdit Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 3) - Verifying Drivers with the Verifier Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 2) - Verifying System Files with the SFC Utility
- Windows Server 2008 Server Core : Virus and External Intrusion Protection (part 1)
- Windows Server 2008 Server Core : Managing System Users - Discovering User Identity with the WhoAmI Utility
- Exchange Server 2010 : Installing a Windows Certification Authority Server
- Exchange Server 2010 : Understanding Public Key Infrastructure (part 2) - Manual Encrypted Communications Using Outlook
 
 
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