***Note from Migration:***
Original Title was: Better and more consistent support for lists/collections (of one) when reading XML
Hi,
I've just encountered a very irritating problem, that comes from FME handling lists/collections in an unexpected way (at least to me).
When I read an XML file, each item may have a collection of sub items, which may contain 0 or more items.
When FME reads the parent item, and finds sub items, it stores these in a list.
EXCEPT when there's just one sub item! Then the sub item attributes gets stored in non-list multi-level attributes.
This is inconsistent imho. If there are _any_ sub items present, a list should be always be generated. [MY SUGGESTION]
In the current scenario, I need three transformers to handle the case:
- Test whether the multi-level attributes exist (single sub item), or the list exists (multiple sub items).
- Rename the attributes if a single sub item is found.
- Explode the list if multiple sub items are found.
If the list was always generated if there are any sub items, I only need step 3.
The multi-level attributes could still be created, if a single sub item is encountered, to keep backward compatability.
Cheers
Lars I.