Mapping large XML documents field by field can be tedious and error-prone. When you have two schemas with identical sub-structures, the Mass Copy Functoid is your best friend.
The Mass Copy functoid allows source records and their containing elements and attributes to be copied and mapped across to the destination schema. It creates a wildcard (/*) XSLT template match to recursively copy elements.
📝 One-Minute Brief
The Mass Copy Functoid is a powerful tool for BizTalk developers needing to replicate entire message sub-structures without manual mapping. This post explains how to use it to copy records and their children—including attributes and nested elements—efficiently. While it’s a huge time-saver for identical schemas, it requires caution as it restricts further mapping of child elements within the destination record.
Benefits
- May provide a performance benefit, as each source and destination elements do not require a 1:1 detailed mapping on all subsequent schema nodes, requiring fewer XSLT code instructions to be interpreted and executed at runtime. Very useful when XML structures in source and destination schemas are compatible (identical).
- Allows a large structure to be mapped quickly during design time
- Very useful when the destination is defined as an <xs:any> type. Mass Copy Functoid can be performed only at the node level, not at the field level. So the node containing the <ANY> field has to be mapped.
What is the Mass Copy Functoid?
Located in the Advanced Functoids category, the Mass Copy functoid allows you to link a source record to a destination record. When executed, it copies the record itself, all its attributes, all its child elements, and all its nested structures in one go.
How to Use It
- Drag the Mass Copy Functoid onto the grid.
- Connect the Source Record to the functoid.
- Connect the functoid to the Destination Record.
Problems/Limitations
- Mass Copy Functoid will “blindly” copy all child elements specified in the destination schema, and it will not copy elements out of order or check for required values in the destination schema.º
Master Every Advanced Functoid
The Mass Copy is just one of many “Advanced” functoids that can simplify your life. To learn the best patterns for looping, conditional mapping, and high-performance XSLT, download my free 400-page book:
👉 BizTalk Mapping Patterns and Best Practices
This reference guide is intended to make your day-to-day life as a developer easier with effective, robust, and organized recipes for success.
Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son.