on 11-01-2012 11:13 AM
I am facing a challenge in a scenario that involves mapping an incoming flat text (invoice list) to a target XML structure. The source is JMS queue, so I have used JMS sender channel and specified the standard content conversion parameters in 'modules' tab. Here are details -
Source flat text format:
IVH|<some pipe separated fields>
IVD|<some pipe separated fields>
SHP|<some pipe separated fields>
IVH|<some pipe separated fields>
IVD|<some pipe separated fields>
IVD|<some pipe separated fields>
SHP|<some pipe separated fields>
IVH|<some pipe separated fields>
IVD|<some pipe separated fields>
SHP|<some pipe separated fields>
IVD|<some pipe separated fields>
SHP|<some pipe separated fields>
SHP|<some pipe separated fields>
As you can see, the text is a list of invoices such that each invoice contains 3 types of records - IVH (1..1), IVD (1..n) and SHP (1..n). In each invoice, IVH is always the first record and occurs only once, but the sequence of IVD and SHP thereafter can vary.
Content conversion in JMS sender is correctly converting above text into corresponding XML structure with various nodes appearing in same order (and at same level) as above. So the source XML looks like -
<MT_Invoice>
<Recordset>
<IVH>
<IVD>
<SHP>
.......
.......
<SHP>
</Recordset>
</MT_Invoice>
Required target XML structure:
It's required to collect all IVD and SHP nodes immediately following a particular IVH node, but preceding the next IVH node. And unfortunately, there are no common identifiers among IVH, IVD and SHP which can be used to link them together. So the target XML should look like -
<IVH>
<IVD/>
<SHP/>
</IVH>
<IVH>
<IVD/>
<IVD/>
<SHP/>
</IVH>
<IVH>
<IVD/>
<SHP/>
<IVD/>
<SHP/>
<SHP/>
</IVH>
I have been trying the XSLT mapping with "following-sibling" clause, but not able to generate target XML fully. Does anyone have any idea here ? Let me know also know if this can be achieved in graphical mapping. Thanks!
Regards,
-Shankar
Hi Shankar,
you can use java udf for your requirement......
using this you can achieve your requirement....
Regards,
Gagan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you check http://scn.sap.com/community/pi-and-soa-middleware/blog/2010/01/14/file-conversion-using-nodeception . It discuss similar problem.
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.