Convert binary(Non XML) data to XML data in OSB using MFL
We use format builder to create mfl files and can’t create mfl files from sbconsole. We would be required Jdevloper to create MFLs.
Let’s take a use case. We have a binary data in the below format
and want to convert into XML
<?xml version=”1.0″ encoding=”UTF-8″?>
Let’s start with an example, and see how it works.
Assuming we do have a Service Bus application with Service Bus project.
1) Right Click on Service Bus project -> New -> MFL
2) Give MFL name and click Finish
3) MFL Format Builder will get open automatically, if not you can write click on the MFL and click Open with Format Builder
4) Click on EmployeeMFL element from the left navigation and you can rename it and click Apply
5) Click on Insert -> Group -> As Child
6) Enter Name as Employees, Select Unlimited(means we can have multiple Employees element) from the Group occurrence section, Click Apply
7) Click on Employee element, Select Insert -> Filed -> As Child
8) Enter Name as FirstName, select Delimiter from the Field Attributes section, enter Value(s) as | symbol, select Code page as UTF-8 and click Apply button
9) Click on Employees element again and, Select Insert -> Filed -> As Child
10) Enter Name as LastName, select Delimiter from the Field Attributes section, enter Value(s) as
n symbol, select Code page as UTF-8 and click Apply button
MFL is done. Now it’s time to test the MFL. Jdevloper provides the inbuilt tool to test the MFL.
10) Click on Tools -> Test from the MFL Format Builder wizard
11) Select Text from the down Tab, Enter the Non-XML data in the left panel, Click on Transform-> Non-XML To XML
And see the result
Note: You can generate the sample file by clicking on the Generate -> Non-XML
That’s it !!