A Parse/Serialize component in MapForce is a hybrid component which is neither a source nor a target component. Given the role they play in the mapping design, such components must be placed in between other source and target components.
You can use a "Parse/Serialize String" component for string parsing when, for some reason, you need to convert a string that has structure (for example, some XML stored as string in a database) into another format. Parsing data from the source string to the "Parse/Serialize" component means that the source string is turned into a MapForce structure, and, thus, you get access to any element or attribute of the source XML stored as string.
Generic "Parse String" component
The diagram above illustrates the typical structure of a MapForce component which parses a string. Note that the "Parse/Serialize String" component is placed in between the source and target of the mapping. What this component does is accept some string structure as input, by means of a single MapForce connector which is connected to its top String node. The output structure can be any of the data targets supported by MapForce.
When you serialize data from a component to string, the reverse happens. Specifically, the entire structure of the MapForce component becomes a string structure which you can further manipulate as necessary. For example, this enables you to write an XML file (or XML fragment) to a database field or to a single cell of an Excel spreadsheet.
Generic "Serialize to String" component
The diagram above illustrates a generic MapForce "Serialize to String" component. What this component does is accept as input any data source supported by MapForce (by means of standard MapForce connectors). The output structure is a string which you can pass further by means of a single MapForce connector drawn from the top String node of the component to a target component item (for example, a spreadsheet cell). For an example, see Example: Serialize to String (XML to Database).
You can designate a component for string parsing or serialization at any time from the mapping window. To do so, click the File/String ( ) button adjacent to the root node, and then select the desired option.
Changing the component mode
|Note:||A "Parse/Serialize String" component cannot read data from a string and write to a string simultaneously. Therefore, the root node can have either an incoming connector or an outgoing connector (not both). An error will be generated if you attempt to use the same component for both operations.|
When you designate a component for string parsing or serialization, the appearance of component changes as follows:
|•||The component gets the parse or serialize prefix in the title.|
|•||The title bar has yellow background color, similar to function components.|
|•||The top node begins with the String: prefix and is identified by the icon.|
|•||If the component parses a string, the output connector from the root node is not meaningful and thus it is not available.|
|•||If the component serializes to a string, the input connector to the root node is not meaningful and thus it is not available.|
When a component is in "Parse/Serialize String" mode, you can change its settings in a similar way as if it were in a file-based mode (see Changing the Component Settings). Note that not all component settings are available when a component is in either "Parse" or "Serialize" mode.
© 2019 Altova GmbH