Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
h3.  New module on the block : Often we come across a requirement to convert XML to text. The module *StrictXml2PlainBean* has made our life easier to do that conversion. *StrictXml2PlainBean* module can be used to convert an XML document in the main payload of the XI message to text format. Within an XML document, different recordset types can be displayed either separately or with a fixed field length (mixed display). The structure of the XML document is checked based on the entries you make in the module. If any structures are found in document that do not correspond to your definition, a processing error is triggered at runtime. h3. _An example is worth a thousand words :_  Lets take a simple example to understand the usability of this module. Lets assume a scenario for converting an XML data to a asterisk separated TEXT file, wherein we don't need any data transformation between source and target and we have same number of fields under the different recordsets. *+Input XML :+* Before the module came,  to convert the above xml to text format, we needed to specify a separate  File Content Conversion for "_Customer_" and for "_ContactInfo_ ". But now we can replace our File Content Conversion with the *StrictXml2PlainBean* module.  The module provides more conversion options and a check of the structure that is to be converted h3. _Lets see how :_ *Step 1: *In your receiver File Communication channel, select the message protocol as "File" and fill the rest of the information needed for your receiver file CC. 


*Step 2:* Go to the_Module tab in your CC_ and insert the module in front of the adapter module as shown in the screen shot.  �›       Enter the module name _AF_Modules/StrictXml2PlainBean_. �›       Select the module type _Local Enterprise Bean._       The default module key is displayed. ( In our case its 1, as highlighted) *Step 3:* In the module configuration, enter the parameter names and parameter values for the module key 1 of the module. Here comes the exciting part. As we can see that in our example we have same number of fields in the "Customer" as well as in the "ContactInfo", we can use the parameter Name "*singleRecordType*" and avoid defining the parameters twice for the different recordset. _Module Key: 1 _ Parameter Name : *singleRecordType* _Parameter Value : dataRec_ *Step 4:*  For the asterisk separator, define the following parameters in your module configuration.  As we have defined "*SingleRecordType*" in the above step, all the parameters we will be defined in our module configuration will be applicable to all recordsets. _Module Key: 1_ _Parameter Name : dataRec.fieldSeparator _  Parameter Value : *

 

13 Comments