Rank: Newbie
Joined: 6/11/2015 Posts: 8 Location: UK
|
Hi. I have an XML structure which I need to "flatten" to text / CSV.
I am struggling over getting a set within that structure to extract into fields in a line, rather than separate lines. This is due to restrictions regarding existing systems.
I am attempting this in Mapforce / Flextext ( I have Altova Missionkit Ent Ed.).
I say I'm struggling, but actually I've not managed anything close yet, and any help in getting me in the right direction would be greatly appreciated.
I have attached a simplified example XML, XSD and the desired output.
File Attachment(s): Qex1.xml (2kb) downloaded 269 time(s). Qex1.xsd (2kb) downloaded 313 time(s). Qex1.csv (1kb) downloaded 238 time(s).
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
This mapping is doing most of your job and should give you a good idea how to do the rest.
Important note: I have let MapForce create a schema automatically, because XML file is not valid according to the XSD you have provided here, and this makes MapForce it difficult/impossible to process your file correctly. vlad attached the following image(s):
|
Rank: Newbie
Joined: 6/11/2015 Posts: 8 Location: UK
|
Vlad! Thanks for replying so quickly.
That solution looks great - something in there that I've not done before. I have applied the logic to my full scenario and it looks as though it works... I did not have an error using my XSD btw.. incidental anyway, as I will of course use the full XSD from my actual live files.
So, I come up with this output from the illustrated MFD...
123456,ABC123,NP22AB001,1,4,$77,Outer door skin,1234567890128, 123456,ABC123,NP22AB001,2,10,$84,Locking assembly,1234567890128, 123456,ABC123,NP09KX002,3,18,$14,Cross member,1234567890128,BLU-SUMMER
Thank you SO MUCH.
Julian Julian attached the following image(s):
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
Just a short note: you may want to create a user defined function to avoid copying the logic three times
|
Rank: Newbie
Joined: 6/11/2015 Posts: 8 Location: UK
|
Thanks for the tip vlad.
|