The Xml Destination Component allows you to flexibly create Xml (or associated CSV, EDI, HL/7, positional or delimited text) within a data-flow. This Xml can be written to a variable or to a column in the data-flow. Further, this can be executed individually for every row or as a single export for the whole data-flow.
The configuration interface is shown below :

You can specify the variable or column to receive the result Xml, the execution mode and the error-handling behavior.
Click the
Edit Mapping... button to launch the BlueSSIS Graphical Mapping utility.

This tool allows you to drag links from the source (left) side to the destination (right side). You can link to and from content or variables. These can be direct links, or via functoids - units of reusable logic. Functoids provide logic including comparisons, counting, mathematical operations, lookups, accumulations, xpath querying, string functions and date / time arithmetic. They can also provide more sophisticated functionality, including database lookups, script functions, enumeration, duplicate elimination, grouping and execution control. To use a functoid, simply drag it from the functoid area on the right onto the main page (between the source and destination areas), and then connect its' inputs and outputs by drag and drop. You can test your map using the functions in the Tools menu.
The source schema is defined by the input columms, and the destination schema is
initially auto-generated. You can customize this as required by clicking
the
Edit Destination Schema link.
This launches the
BlueSSIS Schema editor, within which you can intuitively define Xml schemas and
alternative representations.

You can enter XSD directly, or use the tree view to create a hierarchical structure interactively. You can right-click in the tree control or use the Insert menu to modify the structure. The Properties window allows you to configure advanced properties in relation to the selected item in the tree view.
To define an alternative representation, or more typically to generate an Xml schema from an alternate representation, you can use the Special Schemas form, accessible from the Tools menu and also shown by default the first time the schema editor is launched.
This form guides you through the process of defining a CSV, flat-file (positional or delimited), HL/7 or EDI schema. For further details please see the associated help pages for
BlueIntegrator, our sister product on which this functionality is based, on
Special Schemas and
The Schema Editor.
After selecting schemas, the elements of the schema are shown in the source and
destination trees and can be linked as required.
The graphical mapping tool is also part of our sister application BlueIntegrator, and
full help can be found here. Essentially though at execution time the nodes in the source document are executed in order, passing through functoids as appropriate. Destination nodes are then written to the output document, but are sorted by the hierarchy of the output schema. As values are pushed out from the source document they are active, and active values arriving at the destination will always trigger the creation of a new data item. You can also manually trigger the creation of a new parent element by firing an active value at it. Variables, functoids with no inputs, or functoids with inactive inputs produce passive values, which are used but do not in themselves trigger the creation of a data node. The Passive Values functoid can be used to explicitly make an active value passive, and thus prevent superfluous outputs.
The
Reset Mapping... button on the Xml Destination Component interface can be used instead of
Edit Mapping... to automatically regenerate the output schema from the input columns.
The Value Change functoid is particularly useful for creating structured Xml - this functoid suppresses output except when its' input value changes. Suppose you have input data on telephone numbers, in the following format :
Contact ID |
Telephone |
1 |
09673 372813 |
1 |
012 233 7281 |
2 |
09633 422813 |
3 |
013 232 4923 |
3 |
08633 2932323 |
Note that each contact can have more than one telephone number.
Suppose you also desire Xml data in the following format :
<SSIS>
<Row ContactId="1">
<Telephone>09673 372813</Telephone>
<Telephone>012 233 7281</Telephone>
</Row>
<Row ContactId="2">
<Telephone>09633 422813</Telephone>
</Row>
<Row ContactId="3">
<Telephone>013 232 4923</Telephone>
<Telephone>08633 2932323</Telephone>
</Row>
</SSIS>
This is readily achieved. Simply create an approprite Xml schema (making
sure Telephone has a MaxOccurs > 1), and map through to the ContactId attribute via
a Value Change functoid. This will trigger the creation of a new attribute
(and thus containing element) only when the value changes. Note that this
approach relies on the input data being appropriate sorted.
All BlueSSIS data-flow components also support properties
Fail on truncation and
Unicode mode, allowing you to define applicable truncation and Unicode settings. These properties can be found in the Visual Studio/BIDS Properties window.