Forum Discussion
Hi
I am new to SnapLogic. I need to use the Snap to parse XML file which has multiple elements and nested structure. Do you know where can I start to learn the XML parser or some Snaps? I found really limited resource available on Youtube, Google.
Regards,
Jim
First you have to use the out-of-box XML parser snap and configuring it should be easy as described in SnapLogic documentation. Then the hard part begins after the incoming XML input parsed into JSON is to navigate through the nested structure and map any array or non-existing elements. The best way to do that is to use a series of Mapper snaps and in each mapper you have to use expression language statements which is a subset of JavaScript. To read more about expression language please check the following link:
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438042/Expression+Language+Overview
For example to cast an parsed XML element in JSON into an array type you would use the following expression: [].concat[ element ]
Please refer also to the beginning of this thread for other examples.
Related Content
- 2 years ago
- 2 years ago